Home page   WebCheatSheet.com


How to create a dump of MySQL database in one click


Your users probably asked you to add an option to export the whole database to SQL file. This can be done in phpMyAdmin or Navicat of course but your users want something simpler than that.

Create a new file named backup.php and paste the following code snippet there. Edit database connection settings and path to mysqldump if required. Add a link to backup.php to your application:

Export the whole database

Please note that this script requires write permissions on scripts folder in order to save dump to file and zip it. If your scripts do not have such permissions use the second version of script. The only downside is that dump file won't be zipped.

Version with zipping. Requires write permissions on scripts folder.

Version without zipping. Write permissions are not required.



Copyright © 2005-2007 www.WebCheatSheet.com All Rights Reserved.