Linux Centos7 Mysql forgot password how to retrieve your password

1,mysqld --skip-grant-tables --user=mysql &   
    //跳过数据库权限验证
2,systemctl restart mysqld
正常情况是起不来 的等个大概10秒ctrl + c终止
3,输入mysql 即可进入
4,UPDATE mysql.user SET authentication_string=password('new_password')
WHERE user='root' AND host='localhost';  
            //修改新密码
5,FLUSH PRIVILEGES;   刷新授权表
6,exit 退出数据库重新用新密码登录,即可登录成功
7,最好reboot重启一下,使mysql变为运行状态

Note: error processing

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

Solution: ALTER USER 'root' @ 'localhost' IDENTIFIED BY 'xinmima';

Guess you like

Origin blog.51cto.com/14482279/2432430