4.21

第二天就遇到了问题

参考了很多资料:了解到:

很多用户在使用Navicat Premium 12连接MySQL数据库时会出现Authentication plugin ‘caching_sha2_password’ cannot be loaded的错误。

出现这个原因是mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password, 解决问题方法有两种,一种是升级navicat驱动,一种是把mysql用户登录密码加密规则还原成mysql_native_password.

那我们就改表mysql的加密规则:
先登录mysql

 
mysql -u root -p

一定要先赋予权限:

 
grant all privileges on *.* to root@'localhost' identified by '密码';

报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘identified by ‘123456’’ at line 1

mysql8已经不支持这种写法:要用

 
grant all privileges on *.* to 'root'@'%' ;

或:

 
grant all privileges on *.* to 'root'@'localhost' ;
mysql> use mysql;
select user,host from user;

 然后输入:
注意我的root,host是’%’

 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
 ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 

刷新权限:

 
FLUSH PRIVILEGES;

然后重新连接

 

posted @   yblll  阅读(5)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2023-04-21 4.21打卡
2023-04-21 4.20打卡
点击右上角即可分享
微信分享提示