The solution to the 2059 error when Navicat connects to MySQL8.0

foreword

I have been using MySql 5.6 version at work, thinking that MySQL8 has been released for several years, I installed a test database locally to have a look, but after the installation is completed, I use Navicat to connect and always report 2059 errors, which is really strange.
2059

Check (baidu)

I checked the reason at night, and it is said that the default encryption rule is in the version before MySql8, mysql_native_passwordbut in the version after MySql8, the default encryption rule has been adjusted to caching_sha2_password, because Navicat does not support the latest caching_sha2_passwordencryption rule, resulting in a connection error.

solution

After knowing the reason, the solution is also very simple, just modify the encryption rules of the database user.

mysql -uroot -p ## 登录数据库

use mysql;

ALTER USER 'root'@'%' IDENTIFIED BY 'abc123' PASSWORD EXPIRE NEVER; ##修改加密规则,其中abc123为修改后的密码
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'abc123';##修改密码

FLUSH PRIVILEGES; #刷新权限

After the above operations, use Navicat to connect to the database, and it may be connected normally.
connection succeeded

Guess you like

Origin blog.csdn.net/m0_58016522/article/details/122512044