开发者

MySQL to MySQL clone with PHP

开发者 https://www.devze.com 2023-01-16 22:19 出处:网络
Anyone know of a PHP script that will clone an entire MyS开发者_运维技巧QL database to another on another server? As a sort of backup?You\'d have your PHP script run (with e.g. the exec() or system()

Anyone know of a PHP script that will clone an entire MyS开发者_运维技巧QL database to another on another server? As a sort of backup?


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.


phpMyAdmin does this very well. Of course, if you had shell access, try this instead:

mysqldump -u [username] -p [password] [database] > [filename]


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消