Create / Export MySQL Database backup using PHP

12

How can you create a MySQL Database backup using PHP.If you think the database is too large as GB how do you get a fastest backup?In this post will describes how to create a MySQL Database backup/dump quickly instead of using phpmyadmin access using PHP.Also you can save your time to get backup.

Following function will creating/export your database.Only you have to call to this function with passing database parameters.

Now you have to call to above function to create a backup file.

That’s only.

[stextbox id=”info”]Additional[/stextbox]
  • How to create backup file as gz format?

  • Put the following script with replacing line 77,78,79.

  • How to create backup for specific table?

  • Simply pass the table names to the function as follows.

  • How to create backup for more than one tables?

  • Pass the table names as string.

This method I tested more than ten times using 2GB large MySQL database file.If you want to get database backup daily you can put this file in to the cpanel as CRON job.

Download Create/Export MySQL Database backup using PHP Example(2 KB)

Share.

About Author

Sumith Harshan is the Web Engineer Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, Wordpress, Joomla, Drupal,PHPBB,Facebook App Developing and Open cart...etc.