mysql 8.x忘记密码&开启远程连接

1. 在mysqld 配置项添加

skip-grant-tables

2. 重启mysqld

3. 将root密码置空

mysql> update user set authentication_string='' where user='root';

4. 退出,注释掉skip-grant-tables,并重启,再次进入就不需要密码了

4. 再次进入修改MySQL密码

alter user 'root'@'%' identified with mysql_native_password by '26SE>Z%UddNN';

5. 重启mysql验证

 ——————————————————————————————————————

开启远程连接

修改配置文件

bind-address=0.0.0.0

进入mysql修改user表

use mysql
update user set host = '%' where user = 'root';  # 修改远程访问

 重启mysql

 

posted @   不会跳舞的胖子  阅读(109)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示