1.docker启动mysql 方法:

https://hub.docker.com/_/mysql

找到命令并修改mysql名字和密码

docker run --name one-mysql -e MYSQL_ROOT_PASSWORD=password -d mysql

2.安装完成后查看

 docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED         STATUS         PORTS                 NAMES
cc4a81197502   mysql     "docker-entrypoint.s…"   6 seconds ago   Up 5 seconds   3306/tcp, 33060/tcp   one-mysql

3.关闭mysql服务

 docker stop one-mysql

4.查看是否关闭

 docker ps -a

5.启动mysql

 docker start one-mysql

6.持续打印mysql的log

 docker logs -f one-mysql

7.移除mysql,需要先docker stop one-mysql

 docker rm one-mysql

8.改变mysql运行端口

docker run --name one-mysql -e MYSQL_ROOT_PASSWORD=password -p 28001:3306 -d mysql
Copyright © OneZos all right reserved,powered by Gitbook本书发布时间: 2021-06-09 09:58:10

results matching ""

    No results matching ""