This recipe explain how to make a backup of a complete database in a easy way. Then, the backup file can be restored when a disaster occurs.

Make a backup

The required command is mysqldump that has the next syntax:

mysqldump -u [user] -p [dbname] > [backup.sql]

A sample:

# mysqldump --single-transaction -u admin -p drupal > drupal_backup.sql

Restore de database from a file

This is the same method to load a .sql file:

# mysql -u admin -p drupal < drupal_backup.sql

References



blog comments powered by Disqus