1.进入mysql容器中
docker exec -it mysqltest(mysql容器名称) bash
2.进入mysql数据库
mysql -uroot -p
3.输入mysql密码
4.远程连接授权
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘WITH GRANT OPTION;
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 ‘密码‘;
7.刷新权限
mysql>FLUSH PRIVILEGES;
8.Navicat连接测试
原文地址:https://www.cnblogs.com/guduershi/p/10472271.html
时间: 2024-10-07 01:12:01