[Application] Docker install MySQL (six)

  MySQL is the world's most popular open source database. With its reliability, performance and ease of use, MySQL has become the database of the Web application preferences.

  Environment: CentOS 7.4

  docker Version: 19.03.8

1, view the available versions of MySQL

  Access to MySQL database mirroring address: https://hub.docker.com/_/mysql?tab=tags  .

  You can see by the other versions of MySQL through Sort, the default is the latest version of  MySQL: Latest  .

  In addition, we can also use  docker search mysql command to view the available versions:

    

2, mirrored pull MySQL

  Here we pull the latest version of the official image:

  Command: Docker pull MySQL: Latest

3. Check local mirror

  Use the following command to view whether the mysql installation:

  Command: Docker ImagesRF Royalty Free

  

  In the image above you can see that we have the latest version (latest) installation of mysql mirror.

4, run container

  After installation is complete, we can use the following command to run mysql container:

  命令:docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql

  Parameter Description:

  • 3306 -p: 3306  : 3306 mapping service container port to host the 3306 port, an external host can directly through the  ip host: 3306 Access to MySQL service.
  • = 123456 MYSQL_ROOT_PASSWORD : Set MySQL root password service.

5, the installation was successful

  By  to see if the installation was successful docker ps command:

  

  This machine can access the MySQL service by root and password 123456.

  Command: Docker Exec -it ec3819e2d67d / bin / bash , log on to the container

  

 

Guess you like

Origin www.cnblogs.com/h--d/p/12590400.html