美文网首页
mysql 8 重置密码

mysql 8 重置密码

作者: 我是大飛 | 来源:发表于2021-02-22 15:35 被阅读0次

打开配置文件

vim /ect/my.cnf

找到 [mysqld] 选项,在其最后添加 skip-grant-tables


image.png

重启 mysqld

service mysqld restart

重新登录mysql

msyql -u root -p
# 无需密码

修改密码

use mysql;
select host, user, authentication_string, plugin from user; # 查看加密方式和密码
update user set authentication_string = '' where user = 'root'; # 去掉密码

去掉 /etc/my.cnf 中免密登录设置
重启 mysqld

service mysqld restart

完事,即可无密码登录,重新修改密码.

alter user 'root'@'%' identified by 'your password'; # 修改密码

相关文章

网友评论

      本文标题:mysql 8 重置密码

      本文链接:https://www.haomeiwen.com/subject/asqkfltx.html