Welcome Guest, Not a member yet? Register   Sign In
do restore from database backup

[eluser]Lic. Roberto Estupiñán Pérez[/eluser]
I need to restore a mysql database, which previously I did a backup with the function $ this-> dbutil-> backup ();



[eluser]Ben Edmunds[/eluser]
You can restore it from CLI with

mysql -u username -p databasename < sqlfile.sql

Or if you have access to phpMyAdmin, you can use the Import function to import the sql file. Will do the same thing as the command line solution Ben posted in case you don't have access to the command line.

but how do I restore it form the front end, web application end. If the user wants to go to a earlier point a CLI or phpmyadmin access will not work. How can I give access via the web application end???

You could write a function, which takes the file ( the *.sql file ) and executes it.

The file uploading part do it in the controller, read the content and send it to the model,
then in the model do this

$query_list = explode(";", $file_content);

foreach($query_list as $query)

That is a way to do it but it will drop all the tables and recreate it. If we could have a robust way like http://drupal.org/project/backup_migrate - Drupal's backup and migrate module which just puts data it'd be great. I'll research on it more. thanks for the help.

So basically what you want, is to be able choose what you want to backup (structure only, data only, structure and data), then based on the backup do the restore.

Theme © iAndrew 2016 - Forum software by © MyBB