Error 2059 when mysql connects to the database
Error 2059 when mysql connects to the database
reason
A new version of mysql8 is released, and a 2059 error occurs after installation. The reason is that the encryption rule in versions before mysql8 is mysql_native_password, and the encryption rule after mysql8 is caching_sha2_password.
So change the encryption method back to the old version through the command line.
Solution
admin run cmd
Execute the command
to enter the database: mysql -u root -p
If you are prompted that MySQL is not an internal or external command, you need to add the MySQL bin directory to the system environment variables.
use mysql;
Check the current encryption method:
select user,plugin from user where user='root';
You can see that the encryption method of the current user is caching_sha2_password
Modify the encryption method
First, you need to check what the host of your root user is,
select user,host from user;
and then modify it according to the host:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
the bolded place needs to be modified to your own host name and password.
Finally, refresh the permissions to successfully connect.
flush privileges;