Home Backup & restore MYSQL MariaDB databases
Post
Cancel

Backup & restore MYSQL MariaDB databases

Backing up

1
mysqldump --add-drop-table --databases mydatabase_db > /home/wiki/db/$(/bin/date +\\%Y-\\%m-\\%d).sql.bak
  • mysqldump is the backup tool Read More
  • add-drop-table removes one or more tables Read More
  • –databases is defining the db name, i.e.mydatabase_db
  • > Forward this output to the /path/the/folder

Restoring

1
mysql -u root mydatabase_db  < 2019-09-10.sql.bak

Your location my be more like /path/to/file/2019-09-10.sql.bak

This post is licensed under CC BY 4.0 by the author.