mysql8.0密码设置之后登陆不上的问题

执行alter user 'root'@'localhost' identified with mysql_native_password by '密码'; 后,执行

select host, user, authentication_string, plugin from user; root那行密码是没有加密过的密码导致一直登不上。

解决方法是执行alter user 'root'@'localhost' identified by '密码';密码显示成一串加密字符串,验证也没有问题,就没有问题了mysql8.0密码设置之后登陆不上的问题

 

 

所以完整正确的过程如下:

1.停止mysql服务;

2.管理员方式打开cmd,cd 到bin目录下;

3.执行mysqld --console --skip-grant-tables --shared-memory;

4.这个窗口放着,用管理员身份再开一个窗口,cd到bin目录下;

5.执行mysql.exe -u root;

6.执行select host, user, authentication_string, plugin from user;

7.执行alter user 'root'@'localhost' identified by '密码';

8.执行 FLUSH PRIVILEGES;

9.再执行select host, user, authentication_string, plugin from user;检查一下;

10.关闭两个窗口,重启服务;

11.尝试登陆。