1# If you run the container with a command like the following:
2# sudo docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
3
4sudo docker exec -t -i some-mysql /bin/bash
5mysql -uroot -pmy-secret-pw
6
7# An example below:
8sudo docker run --name mysqldb -e MYSQL_ROOT_PASSWORD=MySecretPass -d mysql:latest
9sudo docker start mysqldb
10sudo docker exec -t -i mysqldb /bin/bash
11mysql -uroot -pMySecretPass
1docker container run -d -p 3306:3306 --name mysql --env MYSQL_ROOT_PASSWORD=123456 mysql
2
3docker container exec -it mysql bash
1$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
1docker exec <container_id> /bin/sh -c 'mysql -u root -ppassword </dummy.sql'
2
1$ docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql