DEV Community

Reishi Mitani
Reishi Mitani

Posted on

SQL Dump in Docker

First, enter your mysql docker container.

// in your local machine
$  docker exec -it up_mysql_1 /bin/bash
Enter fullscreen mode Exit fullscreen mode

Dump your file.

# mysqldump -u root -p DB_NAME > outputfile.sql
Enter fullscreen mode Exit fullscreen mode

The file will be dumped in your docker container.
Transport the file to your local machine using the following command.

// in your local machine
$ docker cp CONTAINER_ID:/outputfile.sql ~/Documents/outputfile.sql
Enter fullscreen mode Exit fullscreen mode

Top comments (0)