English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
MySQL is the most popular open-source database in the world. With its reliability, ease of use, and performance, MySQL has become the preferred database for web applications.
Visit the MySQL image 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 .
You can also find other versions you want in the dropdown list:
In addition, we can also use the docker search mysql command to view available 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] ...
Here we pull the latest version of the official image:
$ docker pull mysql:latest
Use the following command to check if mysql is installed:
$ docker images
As can be seen in the figure above, we have installed the latest version (latest) of the mysql image.
After the installation is complete, we can use the following command to run the mysql container:
$ docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql
Parameter Description:
-p 3306:3306 Mapped container service 3306 Port to the host 3306 Port, the external host can directly access the host ip:3306 Access the MySQL service.
MYSQL_ROOT_PASSWORD=123456Set the password for the MySQL service root user.
Check if the installation is successful using the docker ps command:
This machine can be accessed via root and password 123456 Access the MySQL service.