I have a problem with a module the site functions but I need to roll the database back to the backup I took before deploying the module. How can I do that?I am using D8

  • 1
    How did you take the backup? – Jaypan Feb 14 '17 at 12:48
  • At cpanel-Back up-Download a MySQL Database Backup. I saved it locally on my computer. – kyriakib Feb 14 '17 at 12:59
  • Cpanel generally links to PHPMyAdmin - if you go to that and select your database, there should be an 'import' tab. Go there and upload your backup. – Jaypan Feb 14 '17 at 13:00
  • I also have a folder on my computer with a zipped file containing all the site files i backed up Should I also delete the site files I have now in the root directory and upload the backuped ones, or just proceed with the database? – kyriakib Feb 14 '17 at 13:06
  • You want the code on the server to match the code as it was when you took the backup. So if any files have been changed or removed since you took the backup, you need to make sure those files are the same state they were in when you took the backup. However, if you only added files after taking the backup (not changing or removing any files), then you shouldn't need to replace the files on the server. – Jaypan Feb 14 '17 at 13:23

You can use Drush.

All you need to do is to run, inside a Drupal instalation, the following command:

drush sqlc < path/to/backup.sql

*You may want to drop your current database before that. The command is:

drush sql-drop -y

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.