1,docker Pull MySQL image :

docker pull mysql:latest

2,docker View local image :

docker images

3, function MySQL container :

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

4, View running containers

docker ps -a

5, close mysql

docker stop 20c9f0d80723    ( be careful : Here 20c9f0d80723 Yes, No 4 Found in step mysql of CONTAINER ID
, According to your container ID  fill in )

6, function mysql container

docker run -dit --name mysql8.0 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456

7, get into mysql container

docker exec -it mysql8.0 /bin/bash

8, Sign in mysql

mysql -u root -p123456

Parameter description :

-p 3306:3306 : Mapping Container Services 3306 Port to host 3306 port , External hosts can directly Host computer ip:3306 Access to MySQL Services for .
MYSQL_ROOT_PASSWORD=123456: set up MySQL service root User's password .

4, You can view the started docker container

docker ps

©2019-2020 Toolsou All rights reserved,
Solve in servlet The Chinese output in is a question mark C String function and character function in language MySQL management 35 A small coup optimization Java performance —— Concise article Seven sorting algorithms (java code ) use Ansible Batch deployment SSH Password free login to remote host according to excel generate create Build table SQL sentence Spring Source code series ( sixteen )Spring merge BeanDefinition Principle of Virtual machine installation Linux course What are the common exception classes ?