Linux Centos7 Mysql 忘记密码怎么找回密码

1,跳过数据库权限验证mysql

mysqld --skip-grant-tables --user=mysql &

2,sql

systemctl restart mysqld

正常状况是起不来 的等个大概10秒ctrl + c终止数据库

3,输入mysql 便可进入ide

4,修改新密码this

UPDATE mysql.user SET authentication_string=password('new_password')
WHERE user='root' AND host='localhost';

5,刷新受权表rest

FLUSH PRIVILEGES;   刷新受权表

6,exit 退出数据库从新用新密码登陆,便可登陆成功
7,最好reboot重启一下,使mysql变为运行状态code

注意:报错处理ip

问题1:ERROR You must reset your password using ALTER USER statement before executing this statementstring

解决方案:ALTER USER 'root'@'localhost' IDENTIFIED BY 'xinmima';it

相关文章
相关标签/搜索