Although phpMyAdmin can do most of the Import and Export job for small scale database, I still required an automated way to do the backup together with cron tool. Furthermore, phpMyAdmin is not realiable because it is an PHP level implementation. Running a large scale database such as a well establish forum can be a pain if you have phpMyAdmin as your only option. exec MysqldumpMysqldump is a very important sub application provided by the Mysql database system to perform backup, fast and reliable. However, as PHP has no function interface to access this application, the only choice leave are calling it thru exec, system, or passthru: exec("mysqldump --add-drop-table --host=localhost --user='' --password='' dbname"); However, due to security reasons, most share hosting provider has blocked this php function, making the solution impossible. SELECT INTO OUTFILESince then, programmer has been creatively using alternative to solve the issue. Mysql query provide this SELECT INTO OUTFILE feature to allow programmers to dump chuck of data from SELECT into a file specified. $backupFile = 'backup/mypet.sql'; Again, I was unable to use this function on my share hosting server. ACCESS DENIED error issued. PHP ImplementationI then forced to search for other alternative on PHP level. I do not like this option as it is very unpredictable/unstable due to the maximum script execution time setting which would cause the script to quit half way while backing up a very large database. Worst still, without any warning. As result, the exported sql file is corrupted and unusable. The open source community have come out few class for it. Mysql Backup by Vagharshak TozalakyanDownload: http://www.phpclasses.org/browse/package/2779.html Using the class is easy: <?php require_once 'mysql_backup.class.php'; ?> However, I found the class is not working on unicode data. To fix it:
MySQL Dump by Marcus ViníciusDownload: http://www.phpclasses.org/browse/package/2527.html Using the class is easy: <?php I haven't try this class yet. It would be useful to backup the whole database at once. |
Top
|




Top
Loading...
Rss Feed