Linux Mysql遇到了重置密码错误

系统版本:CentOS-7-x86_64-Minimal-1804.iso
Mysql版本:mysql-5.7.27-1.el7.x86_64.rpm-bundle

重置密码发生了错误

  • Access denied for user ‘root’@‘localhost’ (using password: YES) 密码错误

  • Access denied for user ‘root’@‘localhost’ (using password: NO)没有键入密码

一、停止mysql服务

service mysqld stop

二 、配置文件

vim /etc/my.cnf

Linux Mysql遇到了重置密码错误
在[mysqld]下键入skip-grant-tables
键入这句话是忽略权限问题,

3、重启MySQL

systemctl restart mysqld

Linux Mysql遇到了重置密码错误

4、执行命令

依次键入 mysql -u root use mysql update user set
password=password(“输入你要的密码”)where user=“root” MySQL版本是5.7之后 update
user set authentication_string=password(“输入你要的密码”)where user=“root”

5、重启MySQL

systemctl restart mysqld

Linux Mysql遇到了重置密码错误

6、重新输入密码

mysql -u root -p 回车

Linux Mysql遇到了重置密码错误
在Eenter passwor:输入刚设置的密码

相关文章: