mysql忘记root密码实现免密登录

1.配置my.cnf文件,跳过授权表:

skip-grant-tables

2.重启mysqld服务

3.z直接mysql登录

4.use mysql这个数据库

5.设置密码:

update user set authentication_string = password(‘password'), password_expired = 'N', password_last_changed = now() where user = 'root';

6.刷新授权表:flush privileges

7.退出mysql且删除配置文件里的skip-grant-tables

8.重启mysql服务

9.登录mysql

 
posted @ 2021-08-30 00:05  多次拒绝黄宗泽  阅读(132)  评论(0)    收藏  举报