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

[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 ();

thks.

Roberto
CU.
#2

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


mysql -u username -p databasename < sqlfile.sql
#3

[eluser]Developer13[/eluser]
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.
#4

[eluser]geshan[/eluser]
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???
#5

[eluser]flaky[/eluser]
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

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

foreach($query_list as $query)
     $this->db->query($query);
#6

[eluser]geshan[/eluser]
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.
#7

[eluser]flaky[/eluser]
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