MySQL (version 8.0) connection error: 1251 [How to Solve]

1. Error reporting

2. Reasons for error reporting

Because the encryption method of MySQL 8.0 is different from that of MySQL 5.0, an error will be reported when connecting

3. Solutions

You need to change the encryption method to connect successfully (follow the steps below).

1. Enter the DOS command and execute the following code to enter the database

mysql -uroot -proot //-u(database account) -p(database password)

2. Execute the following command

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password set during mysql installation';

You can also change the password with this command: change the password in the command to the new one

After completing the above two steps, there will be no error when connecting again.

Read More: