How to install MySQL in Docker ?

How to install MySQL in Docker ?

Installing Particular Version

[code]
sudo docker pull mysql/mysql-server:5.7
[/code]

 

Installing Latest Version

[code]
sudo docker pull mysql
[/code]

 

Running MySql Docker Image:

[code]
sudo docker run –name mysqlcname -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 –restart always -d mysql
[/code]

-d => to start it automatically when the server started.

 

 

Docker useful commands for Beginners:

You can also find other useful docker commands here.

Leave a Reply