1.1 编辑配置文件:输入命令
vi /etc/mysql/conf.d/docker.cnf
1.2 docker.cnf文件中添加skip-grant-tables跳过权限认证
[mysqld] skip-host-cache skip-name-resolve skip-grant-tables
或:
mysqld -nt –skip-grant-tables
1.3 具体描述
1.4 查看当前密码策略
update user set host='%' where user='root';
最后执行:flush privileges;
1.5 创建新用户和密码输入以下命令
grant usage on *.* to ‘zhihao'@'localhost' identified by ‘123456';
1.6 授权可以远程登录
grant all privileges on *.* to root@'%'identified by 'passwd';//设置可以远程访问
1.7 修改密码
update user set authentication_string=password(‘xxx’) where user=’账户名’ and host=’localhost’;
1.7 刷新权限
flush privileges;
欢迎关注作者微信公众号