docker安装mysql8.0.18

docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /var/mysql/lib:/var/lib/mysql:rw -v /var/mysql/mysql-files:/var/lib/mysql-files:rw -v /var/mysql/log:/var/log/mysql:rw -v /var/mysql/etc:/etc/mysql:rw -v /etc/localtime:/etc/localtime:ro --name mysql --restart=always -d mysql:8.0.16

查看docker:

docker ps
  
docker exec -it 28bc5ff6de08 /bin/bash
//进入了docker镜像内部
mysql -uroot -p
//输入初始密码:123456
use mysql; 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES; 

 

  
 navicat链接测试:
 


 

 

 

posted @ 2020-09-23 12:34  水滴-石穿  阅读(336)  评论(0编辑  收藏  举报