Export whole MySql database

This is a discussion on Export whole MySql database within the PHP Language forums, part of the PHP Programming Forums category; Hi folks, I am looking for the straightest way to export a whole MySql database, but all I can find ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-23-2008
Franz Marksteiner
 
Posts: n/a
Default Export whole MySql database

Hi folks,

I am looking for the straightest way to export a whole MySql database, but
all I can find is SQL statements to export specific tables.
Any suggestions?

--
Freundliche Grüße,
Franz Marksteiner

Reply With Quote
  #2 (permalink)  
Old 02-23-2008
Jerry Stuckle
 
Posts: n/a
Default Re: Export whole MySql database

Franz Marksteiner wrote:
> Hi folks,
>
> I am looking for the straightest way to export a whole MySql database,
> but all I can find is SQL statements to export specific tables.
> Any suggestions?
>


Try a mysql newsgroup - such as comp.databases.mysql. Your question has
nothing to do with PHP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #3 (permalink)  
Old 02-23-2008
icu5545
 
Posts: n/a
Default Re: Export whole MySql database

On Feb 23, 1:28 pm, "Franz Marksteiner" <franzmarkstei...@gmail.com>
wrote:
> Hi folks,
>
> I am looking for the straightest way to export a whole MySql database, but
> all I can find is SQL statements to export specific tables.
> Any suggestions?
>
> --
> Freundliche Grüße,
> Franz Marksteiner


I think PHPMyAdmin will do it. That is, if you have access to that
handy little program.
Reply With Quote
  #4 (permalink)  
Old 02-23-2008
Franz Marksteiner
 
Posts: n/a
Default Re: Export whole MySql database

Jerry Stuckle wrote:
> Franz Marksteiner wrote:
>> Hi folks,
>>
>> I am looking for the straightest way to export a whole MySql
>> database, but all I can find is SQL statements to export specific
>> tables. Any suggestions?
>>

>
> Try a mysql newsgroup - such as comp.databases.mysql. Your question
> has nothing to do with PHP.


Just because the string "PHP" does not show up in my post, does not mean
that the post has nothing to do with it...

So if you ain`t got a clue simply don`t answer...

--
Freundliche Grüße,
Franz Marksteiner

Reply With Quote
  #5 (permalink)  
Old 02-23-2008
Jerry Stuckle
 
Posts: n/a
Default Re: Export whole MySql database

Franz Marksteiner wrote:
> Jerry Stuckle wrote:
>> Franz Marksteiner wrote:
>>> Hi folks,
>>>
>>> I am looking for the straightest way to export a whole MySql
>>> database, but all I can find is SQL statements to export specific
>>> tables. Any suggestions?
>>>

>>
>> Try a mysql newsgroup - such as comp.databases.mysql. Your question
>> has nothing to do with PHP.

>
> Just because the string "PHP" does not show up in my post, does not mean
> that the post has nothing to do with it...
>
> So if you ain`t got a clue simply don`t answer...
>


Oh, I've got a clue. But you sure don't.

This isn't a MySQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #6 (permalink)  
Old 02-23-2008
Jerry Stuckle
 
Posts: n/a
Default Re: Export whole MySql database

Franz Marksteiner wrote:
> Jerry Stuckle wrote:
>> Franz Marksteiner wrote:
>>> Hi folks,
>>>
>>> I am looking for the straightest way to export a whole MySql
>>> database, but all I can find is SQL statements to export specific
>>> tables. Any suggestions?
>>>

>>
>> Try a mysql newsgroup - such as comp.databases.mysql. Your question
>> has nothing to do with PHP.

>
> Just because the string "PHP" does not show up in my post, does not mean
> that the post has nothing to do with it...
>
> So if you ain`t got a clue simply don`t answer...
>


And BTW - if you have a PHP question, what is that PHP question? All
you've asked about is MySQL - and this is not a MySQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #7 (permalink)  
Old 02-23-2008
Luuk
 
Posts: n/a
Default Re: Export whole MySql database

Franz Marksteiner schreef:
> Jerry Stuckle wrote:
>> Franz Marksteiner wrote:
>>> Hi folks,
>>>
>>> I am looking for the straightest way to export a whole MySql
>>> database, but all I can find is SQL statements to export specific
>>> tables. Any suggestions?
>>>

>>
>> Try a mysql newsgroup - such as comp.databases.mysql. Your question
>> has nothing to do with PHP.

>
> Just because the string "PHP" does not show up in my post, does not mean
> that the post has nothing to do with it...
>
> So if you ain`t got a clue simply don`t answer...
>


system("mysqldump <...parameters...>");


for correct '<...parameters...>' please ask in some MySQL newsgroup ;-)

--
Luuk
Reply With Quote
  #8 (permalink)  
Old 02-23-2008
Anonymous
 
Posts: n/a
Default Re: Export whole MySql database

Franz Marksteiner wrote:
>
> Hi folks,
>
> I am looking for the straightest way to export a whole MySql database, but
> all I can find is SQL statements to export specific tables.
> Any suggestions?
>


Type this into a command prompt:

"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump.exe"
--all-databases --lock-all-tables -u root -p > databases.sql

Of course, if the MySQL bin directory is in your path typing

mysqldump --all-databases --lock-all-tables -u root -p > databases.sql

will suffice. If your username is different then replace root with it.
You will be prompted for the password.

If you want to backup a remote database on Linux just connect to the
server via SSH or telnet and type in the same thing. Then transfer the
file databases.sql to your computer. You might want to compress it
before that.


@Jerry: Yes, you are right and Franz is wrong about this question being
offtopic here. But answering the question in a short way and politely
redirect him to a place where he can receive more competent help than
here makes it more likely that he will listen to you. Being an ass about
the fact that he is wrong here does not help anybody and will only
generate more offtopic followups. No insult intended.

Bye!
Reply With Quote
  #9 (permalink)  
Old 02-23-2008
Jeff North
 
Posts: n/a
Default Re: Export whole MySql database

On Sat, 23 Feb 2008 19:28:24 +0100, in comp.lang.php "Franz
Marksteiner" <franzmarksteiner@gmail.com>
<fppok3$qio$01$1@news.t-online.com> wrote:

>| Hi folks,
>|
>| I am looking for the straightest way to export a whole MySql database, but
>| all I can find is SQL statements to export specific tables.
>| Any suggestions?


<?php
/*----------------------------------------------------------------------
Dumps each table within the selected database
out to comma delimited file.

Takes slightly more than 1sec per table
Less time if the Optimize and Repair statements are removed

Destination Folder MUST exist prior to routine being executed
mySQL does not overwrite existing files

----------------------------------------------------------------------*/
//--- fill in required details. User must have FILE privileges
$DB_USERNAME = "";
$DB_PASSWORD = "";
$DB_DATABASE = "";
$DB_SERVER = "";
//--- this folder MUST exist. if files exist they are NOT overwritten
$FILE_SAVE_PATH = "F:/temp/dbDumps/WE20080224/";

function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}

$link = mysql_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if (!mysql_select_db($DB_DATABASE, $link)) {
echo 'Could not select database';
exit;
}
echo "Database Dump starting<br>";
@flush();
@ob_flush();
$result = mysql_query("Show tables");
$startTime = microtime_float();
while ($row = mysql_fetch_array($result)) {
//--- first do a bit of maintenance on the tables
mysql_query("Optimize table ".$row[0]);
mysql_query("Repair table ".$row[0]." EXTENDED USE_FRM");

echo "Exporting Table " . $row[0] . "<br>";
//--- just so that the screen is updated with each table
@flush();
@ob_flush();
mysql_query("SELECT * INTO OUTFILE '" . $FILE_SAVE_PATH . $row[0] .
".txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
FROM " . $row[0]);
}
//--- show some stats
$endTime = microtime_float();
$duration = $endTime - $startTime;
echo "Start: ".number_format($startTime,2,'.',',')."<br>";
echo " Fini: ".number_format($endTime,2,'.',',')."<br>";
echo "Taken: ".number_format($duration,2,'.',',')." seconds<br>";
?>
-- -------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------
Reply With Quote
  #10 (permalink)  
Old 02-23-2008
Michael Fesser
 
Posts: n/a
Default Re: Export whole MySql database

..oO(Franz Marksteiner)

>Just because the string "PHP" does not show up in my post, does not mean
>that the post has nothing to do with it...


What does dumping a DB to a file have to do with PHP?

Micha
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0