sameersbn / docker-mysql

A Dockerfile that installs a mysql server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the easiest way to backup full db

istvano opened this issue · comments

Hi,

Thanks for this great image. I use it in connection with gitlab image you also created. I run the mysql with a data container to keep the mysql data in a data container. I am wondering what is the best way to backup the whole Database ?

Thanks a lot

@istvano You can backup mysql databases using the mysqldump command. Is is one of the ways you can invoke it

docker run -it --rm --volumes-from=mysql sameersbn/mysql:latest \
mysqldump -uroot --add-drop-table [database-name] > database.mysql

Similarly you can backup all databases using,

docker run -it --rm --volumes-from=mysql sameersbn/mysql:latest \
mysqldump -uroot --add-drop-table --all-databases > all.mysql

Please refer to mysqldump documentation for further details.

Hi, thanks a lot !