第n次mysql忘记密码
作者:互联网
1.vi /etc/my.cnf
[mysqld]段落中加上一句:skip-grant-tables保存并退出
2.重启mysql:service mysqld restart
3.进入mysql:mysql -u root
update user set authentication_string='' where user='root';并退出
4.vi /etc/my.cnf
[mysqld]段落中注释:skip-grant-tables保存并退出
5.重启mysql:service mysqld restart
6.再次进入mysql:mysql -u root
6.1.use mysql;
6.2.设置较复杂的新密码:ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '新密码';
6.3.FLUSH PRIVILEGES;
标签:新密码,tables,vi,密码,mysqld,mysql,忘记,root 来源: https://blog.csdn.net/weixin_42026218/article/details/122478382