一、问题复现

┌──(rabbit㉿ASUS)-[/mnt/c/Users/rabbit]
└─$ mysql -uroot -p3xxxxxxxS9uccj -h192.168.xxx.xxx
ERROR 1045 (28000): Access denied for user 'root'@'ASUS.lan' (using password: YES)

二、问题解决

mysql> select user, plugin from mysql.user;
+------------------+-----------------------+
| user             | plugin                |
+------------------+-----------------------+
| root             | auth_socket           |
| debian-sys-maint | caching_sha2_password |
| mysql.infoschema | caching_sha2_password |
| mysql.session    | caching_sha2_password |
| mysql.sys        | caching_sha2_password |
+------------------+-----------------------+
5 rows in set (0.00 sec)

mysql> update mysql.user set plugin='mysql_native_password' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
// 修改用户插件模式,这是报错的根源所在。

mysql> alter user 'root'@'%' identified by '3n6wxxxxxccj';
// 由于 mysql 不断更新,重设密码方式一直变化。
// 该方法是通用方法,故说明。

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
// 记住需要刷新特权表,否则不生效。

mysql> 

相关文章:

  • 2022-01-02
  • 2021-11-06
  • 2021-11-28
  • 2021-04-18
猜你喜欢
  • 2021-12-06
  • 2021-07-30
  • 2021-12-06
相关资源
相似解决方案