Anyone know of a PHP script that will clone an entire MySQL database to another on another server? As a sort of backup?
+5
A:
phpMyAdmin does this very well. Of course, if you had shell access, try this instead:
mysqldump -u [username] -p [password] [database] > [filename]
Delan Azabani
2010-09-19 01:40:47
I am not quite sure what to do with that.
TechplexEngineer
2010-09-19 02:05:59
+1 definitely use `mysqldump` to backup/clone your database.
Daniel Vandersluis
2010-09-19 05:39:38
+1
A:
You'd have your PHP script run (with e.g. the exec() or system() call) something like
mysqldump -q -C --databases mydatabase | mysql -C -h othermachine
Add the appropriate flags to these commands for specifying credentials, etc.
nos
2010-09-19 02:05:14
A:
You can refer this link. -
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
This page is titled
MYSQL DUMP — A Database Backup Program
It contains all the details.
Hope this helps you.
Alpesh
2010-09-19 05:22:18