Andrew Fletcher published: 16 May 2022 (updated) 11 December 2023 1 minute read
These steps are for Drupal 8 and 9.
Export your database
Order here is important. First you want to clear all the Drupal caches. Then export / dump the db the sql database to a file in your home directory.
drush cr
drush sql-dump > path/to/your/file/ourpout/sql-dump-file-name.sql
or
drush sql-dump --extra-dump=--no-tablespaces --result-file=../sql/db-2022-12-07.sql
Without having to manually set the date
drush sql-dump --extra-dump=--no-tablespaces --result-file=../sql/db-$(date +%Y-%m-$d).sql
Import Database
Begin by dropping all the tables in your database. Then with the db empty, import the sql dump back into your Drupal database.
drush sql-drop
drush sql-cli < /path/to/your/file/sql-dump-file-name.sql
or
drush sql-drop
drush sqlc < /path/to/your/file/sql-dump-file-name.sql
Related articles
Andrew Fletcher
•
18 Apr 2024
LogicException: Form errors cannot be set after form validation has finished
When receiving a logic error such asLogicException: Form errors cannot be set after form validation has finished. in Drupal\Core\Form\FormState->setErrorByName() (line 1104 of /var/www/html/project/core/lib/Drupal/Core/Form/FormState.php).This error "LogicException: Form errors cannot be set...
Andrew Fletcher
•
09 Apr 2024
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
Adding a new service to a custom module and the following error greeted me:The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "summaries.reference_node". in...
Andrew Fletcher
•
05 Apr 2024
Drupal 9 to 10 upgrade an example of the actual steps taken
Continuing on from the Drupal 9 to Drupal 10 upgrade outline written earlier... Upgrading Drupal 9 to Drupal 10. However, the point of difference is this article works through the actual action steps of the upgrade.Planning and testing is critical for the Drupal to version 10 process to...