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链接测试:
水滴石穿不止是水的力量,还有重复的力量!