Relational Database Service (MySQL)

What should I do if the login fails after the authentication_string field is changed to display the password for the MySQL database?

2024-06-24 09:42:52

Scenario Description

After you use Navicat to modify the authentication_string field of the root account in the user table to display the password, you cannot log in to the client.

Possible Causes

The way the password was changed was incorrect. The hash key of the authentication_string field in the user table should not be changed directly. Instead, the password of the root user should be reset on the console.

Solution

MySQL 8.0 does not support the password function. Please rectify the fault as follows:

Locate the authentication_string field of the account number and run the following command update mysql.user set authentication_string='XXX', where XXX is the new password. Reset the password of the root account.

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'XXX'; flush privileges;

After the password is changed, you can log in to the system with the root account.


R_N.lALdX4EE