Today I’m going to share with you a very useful script that can create backup of your mysql database and restore it any time you wanted, just as one click recovery of mysql using a php script .
I need to make it because one of my client need this feature in his admin panel So here are the steps to use it.
it take just 5 second for backup and 5 second to restore
Here are some steps you need to take
1. Create an object of class backup_restore
[php]$obj = new backup_restore(‘hostname’,’db_name’,’user’,’paswd’,’*’);[/php]
2. If you want to create backup of your mysql database ,call backup function
[php]$message = $obj–>backup();[/php]
3. If you want to restore your database,call restore function.
[php]$message = $obj–>restore();[/php]
4. That’s it rest of thing ,code will tell you.
Don’t forget to change argument
‘hostname‘ change to ‘your hostname‘.
‘db_name’ change to your database name.
‘username’ change to’ ‘ MySQL username‘.
‘password‘ change to ‘MySQL password‘.
‘path’ is an option argument if you want to store sql dump in a secure location otherwise sql dump will be generated in current directory [NEW ADDED]
‘*’ Change to table name whose backup you want. [ARGUMENT OMITTED]
New Added Feature
- You can store the sql dump at you secret location in the server.
- Added new formatting function
private function remove_accents
private function sql_backquote
private function sql_addslashes - generate pure sql dump. you can download dump file and import it by phpmyadmin.
Instruction and feature:
1. The file this script generate is pure sql file .so you can import it by phpmyadmin.
2. Can handle large db back and restore.
3. Support cms backup. wordpress, joomla, drupal and all others.
4. It does not use mysqldump command ,As many server do not enable shell_exec.
5. It gives 100% sql file.
6. 5-sec for backup and 5-sec for restoration
7.Open Source : Download –> Use –> Improve –> Share . No Warranty.:)
Download script below
zip contain class and example file
Download it free from github
Thank you