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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 ================== |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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 ================== |
|
|||
|
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 ================== |
|
|||
|
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 |
|
|||
|
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! |
|
|||
|
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 -- ------------------------------------------------------------- |