mysql忘记密码(跳过权限修改)

1、在vim /etc/my.cnf添加(跳过权限)

[mysqld]

skip-grant-tables

2、更改密码

注意:版本不同,字段不同(有的版本叫password字段,最新的叫 authentication_string字段),可以查看mysql.user表,然后再进行更改

update mysql.user set authentication_string=password('password') where user='root';

猜你喜欢

转载自www.cnblogs.com/wangyong-blog/p/10238082.html