MySQL (5.x) database backup/restore to file tool
Welcome, I'm looking for php class what allow me to backup MySQL (5.x) databases under PHP.
I test many from phpclasses but most all are written for mysql 4 and under mysql5, generate wrong code.
- Class should allow me to dump my database into file.
- easy restore that file.
- generated开发者_高级运维 file (.sql) should be compatible with phpmyadmin.
You will get better results using mysqldump as compared to phpMyAdmin's SQL Export especially when dealing with large databases and large strings of data
as @Dan mentioned, use exec() or shell_exec() to run the mysqldump command
MySQL has its own dump and import abilities. You can simply call use the mysqldump and mysql clients already installed on your server. If you want to wrap that functionality in a PHP script, build the commands as strings and use exec() or shell_exec() to run them on the system.
精彩评论