tags:

views:

11

answers:

2

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.
A: 

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.

Dan Grossman
Most shared hosting don't allow access to cli.
marc
A: 

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

Dallas Clark
Not solution. Most shared hosting don't allow access to cli (shell)
marc