Manuel Montero
Manuel Montero

Posted on

How to Backup a Database from a Mysql Docker container

To create a backup of your Mysql Database you just need to use docker exec combined with mysqldump as follows:

docker exec CONTAINER_NAME /usr/bin/mysqldump -u USER_NAME --password=USER_PASSWORD DATABASE_NAME > backup_2022-07-22.sql

Using this command will create the file backup_2022-07-22.sql in your local with all the information of your MYSQL Database.

Note: This can be used on MariaDB.

Top comments (0)