docker exec -t -i mysql-test /bin/bash
mysql -uroot -p,会出现Enter password,输入密码,输入后进入mysql>
设置mysql远程连接权限:
0、重新启动服务器的docker
systemctl start docker
1、进入容器:docker exec -it mysqlserver /bin/bash
2、进入msyql:mysql -uroot -p
3、授权:mysql> GRANT ALL ON . TO ‘root’@‘%’;
4、刷新权限:mysql> flush privileges;
5、更新加密规则:mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
6、更新root用户密码:mysql> ALTER USER ‘root’@‘%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
7、刷新权限:mysql> flush privileges;
更多推荐
Docker 进入 mysql步骤(备忘)
发布评论