- Reason: The encryption rule in the version before mysql8 is mysql_native_password, and after mysql8, the encryption rule is caching_sha2_password. There are two ways to solve the problem, one is to upgrade the navicat driver, and the other is to restore the mysql user login password encryption rule to mysql_native_password. This time we will explain the second method
- Enter into mysql:
mysql -u root -p
use mysql
- Check the encryption method:
select user, host, plugin, authentication_string from user;
. if
- user: what usernames mysql has now, such as root
- host: the ip open for the user, such as % means that all IPs can be accessed, it can be 'localhost' (only local access, equivalent to 127.0.0.1), or a specific ' . . . ' (specifically a certain IP )
- plugin: plugin, that is, encryption rules, the new mysql is caching_sha2_password
- authentication_string: encrypted password
- Modify the encryption method and password for connecting to the root user:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
. In this command, root is the username; % is the host to be accessed; password The newly modified password can be customized. Similarly, the encryption method of root@localhost can also be changed.ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
If the execution of this command is invalid, it can be executed to modify the encryption rules before executing this command . - Test if navacat is connected successfully, if not, refresh permissions
FLUSH PRIVILEGES;
- Finally, you can also modify the password separately (or not, because it has been modified above):
alter user 'root'@'%' identified by '111111';
Navicat cannot connect to mysql and mysql password change (Authentication plugin 'caching_sha2_password' cannot be loaded)
Guess you like
Origin blog.csdn.net/weixin_43178406/article/details/120021651
Recommended
Ranking