Sharad Raj

AI Engineer driven by a deep fascination for transformers and their applications in the field of NLP & Computer Vision.

Docker :ship: MySQL setup

12 Oct 2020

Step 1

docker pull mysql/mysql-server:latest

and check

docker images

then

docker run --name=[name-of-container] -d mysql/mysql-server:latest

then

docker ps

Step 2: Find password

docker logs [name-of-container] 2>&1 | grep GENERATED

Step 3

docker exec -it [name-of-container] mysql -uroot -p

Step 4: Change password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-password-here';

Other commands

Start

docker start [name-of-container]

Stop

docker stop [name-of-container]

delete

docker stop [name-of-container]
docker rm [name-of-container]

Errors

In case of

dial unix /var/run/docker.sock: connect: permission denied

run

sudo setfacl --modify user:<user name or ID>:rw /var/run/docker.sock