Hey, this is Mohammad Hassani 😃
if you are developing with Linux and wanna import database to docker with terminal you can use this tutorial...
first of all you should copy your .sql file to
cp DATABASE.sql var/lib/docker/volumes/blog_blogmysql/_data
// Replace DATABASE to your database file name
now your database is ready to import, in this step execute docker in terminal,
(docker desktop is not supported in Linux but you can install dockstation for Linux, they are similar. and then you can execute there)
also in terminal:
docker exec -it CONTAINERNAME bash
// Replace CONTAINERNAME to your container name like
now open mysql in terminal:
mysql -uroot -p DATABASENAME
- if you dont have database in container you can use
mysql -uroot -p
CREATE DATABASE DATABASENAME;
// Replace DATABASENAME to your database name
ok! everything is set now and ready to go...
it maybe take some time depends on your .sql file size and your computer.
- you can use this code instead of step 3 and 4:
mysql --init-command="set autocommit=0" DATABASENAME < var/lib/mysql/DATABASE.sql
if you have another way, leave a message :)
Be happy! ;)