googleghost

Create and restore MySQL/MariaDB backups

Backup

To back up all the databases, create a dump file using the mysqldump tool.

$ mysqldump -A -u root -p > backup.sql

This operation could take some time depending on the database sizes.

NOTE: The steps previously described will only back up the data contained inside your databases. There may be other files that you should take into account when performing a full backup, such as files that may have been uploaded to your application. Refer to your application’s documentation for more details.

Restore

Once you have the backup file, you can restore it with a command like the one below:

$ mysql -u root -p < backup.sql