How can I solve the problem of password and Password Expiration forgotten by Mysql users?
Forgot password:
Step 1: Now find the installation directory of MySQL and change the my-default.ini name of the installation directory to my. ini (D: \ Mysql \ mysql-5.7.13-winx64 );
Step 2: addSkip-grant-tables
And save (this is to remove the security check );
Step 3: restart the MySQL service;
Step 4: run the cmd command to enter the Mysql installation bin directory, enter mysql-uroot-p, and press Enter. (here is an example of account root)
Step 5: 'enter password' appears, and press Enter to Enter mysql>;
Step 6: Enter the command 'use mysql' and press enter, and then enter the SQL statement to change the password:
Update user set password = password ("new_pass") where user = "root ";
In the my. ini fileSkip-grant-tables
Remove and restart mysql.
NOTE: If MySQL5.7.13 is used, a message is displayed.ERROR 1054 (42S22): Unknown column 'Password' in 'field list'
Such an error;
In this way, the SQL statement is changed:
Update user set authentication_string = password ('root') where user = 'root ';
Password expired:
Step 1: use the "Mysql forgot password method" to first access mysql;
Step 2: Change the password_expired value of the user table in the mysql database to N;