MySQL is the most popular open source database in the world. With its reliability, ease of use, and performance, MySQL has become the database of choice for Web applications. Access MySQL Mirror Library address: https://hub.docker.com/_/mysql?tab=tags . You can view other versions of MySQL through Sort by. The default is the latest version. mysql:latest . ` <../wp-content/uploads/2016/06/docker-mysql1.png>` __ You can also find other versions you want in the drop-down list: ` <../wp-content/uploads/2016/06/docker-mysql2.png>`__ In addition, we can use the docker search mysql command to view the available versions: Here we pull the official image of the latest version: ` <../wp-content/uploads/2016/06/docker-mysql3.png>` __ Use the following command to see if mysql is installed: ` <../wp-content/uploads/2016/06/docker-mysql6.png>` __ You can see in the figure above that we have installed the latest version (latest) of the mysql image. After the installation is complete, we can run the mysql container using the following command: Parameter description: -p 3306:3306 Map port 3306 of CCS to port 3306 of CDH. External hosts can access MySQL services directly through CDH ip:3306. MYSQL_ROOT_PASSWORD=123456 Set the password for the MySQL service root user ` <../wp-content/uploads/2016/06/docker-mysql4.png>` __ Use the docker ps command to see if the installation is successful: ` <../wp-content/uploads/2016/06/docker-mysql5.png>` __ The MySQL service can be accessed locally through root and password 123456. ` <../wp-content/uploads/2016/06/docker-mysql7.png>` __ 2.23.1. 1. View the available MySQL versions ¶
$ docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relati... 2529 [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Crea... 161 [OK]
centurylink/mysql Image containing mysql. Optimized to be li... 45 [OK]
sameersbn/mysql 36 [OK]
google/mysql MySQL server for Google Compute Engine 16 [OK]
appcontainers/mysql Centos/Debian Based Customizable MySQL Con... 8 [OK]
marvambass/mysql MySQL Server based on Ubuntu 14.04 6 [OK]
drupaldocker/mysql MySQL for Drupal 2 [OK]
azukiapp/mysql Docker image to run MySQL by Azuki - http:... 2 [OK]
...
2.23.2. 2. Pull MySQL image ¶
$ docker pull mysql:latest
2.23.3. 3. View the local image ¶
$ docker images
2.23.4. 4. Run the container ¶
$ docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
2.23.5. 5. Installation succeeded ¶