采坑日记 linux centos7+docker+mysql5

2020-03-07  本文已影响0人  波波维

1.拉取docker镜像 docker pull mysql/mysql-server:5.7

2.运行镜像 docker run --name=mysql1 -p 3306:3306 -d mysql/mysql-server:5.7

3.获取初始密码

docker logs mysql1

docker logs mysql1 2>&1 | grep GENERATED

4.本地登录 docker exec -it mysql1 mysql -uroot -p

5.修改初始密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

6.赋予远程连接权限 GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
参考:

1官方文档 https://dev.mysql.com/doc/refman/5.7/en/docker-mysql-getting-started.html#docker-starting-mysql-server

上一篇下一篇

猜你喜欢

热点阅读