Last updated 1 min read

Backup and Restore Ghost MySQL DB running with Docker

Related: Ghost Blog


Backup

docker exec CONTAINER /usr/bin/mysqldump -u root --password=THIS_IS_SECRET_PASSWORD DATABASE > backup.sql   

Restore

cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=THIS_IS_SECRET_PASSWORD DATABASE

Restore Ghost Backup:

Feed a SQL backup into a Docker container running Ghost with MySQL:

cat /home/kazai/ghost_production_backup.sql | sudo docker exec -i ghost-kazaimazai-db-1 /usr/bin/mysql -uroot -pTHIS_IS_SECRET_PASSWORD ghost_production


References

[[Make use of MySQL db running inside docker]]