Perfect solution to 2058 error in connection with MySQL 8.0

Time:2020-9-29

introduction

Use sqllog to connect mysql 8.0 (community version: mysql-installer-community-8.0.15.0. MSI), and error 2058 (plug caching) occurs_ sha2_ password could not be loaded:xxxx )The reason of the error is found by searching the data, and the scheme of this problem is put forward in this paper.

reason

The error prompt is shown in the following figure:

Specific reason: for the new MySQL 8.0 installation, when initializing the data directory, the account ‘root’ @’localhost ‘will be created, and the account will be cached_ sha2_ The password is used by default, and the encryption method of the password has changed. Therefore, sqlog cannot parse the password normally, so the above error is reported.

Solution

Run start – all programs – MySQL – MySQL server 8.0 – MySQL 8.0 command line client – Unicode as shown in the following figure:

Type the password for the root account as shown below

Enter the command in the following SQL format, where password is the password of the root account.


ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Execute the command, and the result is query OK, indicating that the modification is successful, as shown in the following figure.

You can successfully connect to MySQL by using sqllog. At this time, view the user table in the MySQL database and find that the plug-in name of the root account has changed, as shown below.

summary

The new version of MySQL has its advantages (some new features) and some disadvantages (some of the operation and maintenance tools can not meet the needs of the new version). Before selecting again, we should fully consider it to avoid some unpredictable problems. Only not only find the problem, solve the problem, summarize the solution, in order to constantly improve themselves, if this article can help you understand or solve the problem, hope to add attention!