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.
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_password
but 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_password
encryption 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.