1

I've backed up my drupal 8 database via the CLI using drush sql-dump > myfile.sql.

I make some changes to the site and break it, then I try to restore it via drush sqlc < myfile.sql.

It works for a bit, until I click something and it messes up again as if there was something written to the files causing it and it is not just the database alone that is the culprit. I get this error:

The website encountered an unexpected error. Please try again later.

A totally vague error as I'm not sure what is causing it.

Are there any files that are written to the Drupal directory that has to be deleted as well when doing a drush sqlc < myfile.sql restore?

3

The website encountered an unexpected error. Please try again later.

There was an error on PHP that Drupal couldn't handle.


If you have your install set to log errors, check the report.

Another option, on your settings.php add:

$config['system.logging']['error_level'] = 'verbose';

To show the errors.

  • 1
    this helped showed me where the culprit was. – Patoshi パトシ Nov 17 '16 at 21:16
3

All drush sqlc does is apply the mysqldump to your database. If the target has tables that are not known of by the source those tables will not be dropped by the dump file before being replaced.

You should take a backup, then run drush sql-drop first, clearing the way for your replacement database.

For example,

drush sql-dump > /location/to/backup-file
drush sql-drop
drush sql-cli < /location/of/myfile.sql

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.