faqts : Computers : Programming : Languages : PHP : Function Libraries : PHP Related

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

88 of 153 people (58%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I backup a MySQL database through PHP only?
Can I backup my database using PHPMyAdmin?
Is it possible to create a PHP script to backup a mySQL database?
Is it possible to create a PHP script to backup a mySQL database?

Jul 2nd, 2000 16:22
Philip Olson, Nathan Wallace, Kevin Edwards, Kevin Yank


Try phpMyAdmin: 

   http://www.phpwizard.net/phpMyAdmin/

As well as a great tool for administering your MySql database, it allows
you to download a dump of the entire database through your web browser.

To do it the old manual way, do this :

   mysqldump -u username -p dbname > dumpname.sql

it'll prompt you for your password & create a dump called dumpname.sql  
If you're not doing this locally then you wanted to do this :

   mysqldump -h source.host.name -u username -p dbname > dumpname.sql


Now, to put this back into a database, do this :

   mysql -u username -p dbname < dumpname.sql

And in case you're putting this in a new database, first create one 
like this :

   mysqladmin -u username -p newdbname

And remember, if you're not doing this locally, add the -h stuff.