栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

docker启动mysql8允许远程连接,并且修改密码

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

docker启动mysql8允许远程连接,并且修改密码

1.修改host
select  user,host,plugin,authentication_string from user;
update user set host = '%' where user = 'root';
flush privileges;
2.修改账号密码
select  user,host,plugin,authentication_string from user;
ALTER USER 'root'@'%' IDENTIFIED WITH caching_sha2_password BY '123';
如果所有的plugin字段都是统一的可以直接使用,否则使用上面的明确指定
ALTER user 'root'@'localhost' IDENTIFIED BY 'root';
3.显示grant-tables问题
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

使用以下指令

flush privileges;
4.显示1045(28000)问题

1 在 /usr/local/mysql/conf.d目录下增加文件: my.cnf 具体目录根据你在使用docker 配置的目录而决定

[mysqld]
skip-grant-tables

然后重启 docker容器

5.如果你只是写了这些内容,你会发现无法连接
Mysql "Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

或者

Mysql "Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

在你修改密码成功后,一定要删除 并且重启 docker容器

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/891342.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号