mysql5.7 password expired or reset password under windows

 Steps to expire or reset the password of mysql under windows:

  1. Stop the mysql service (run services.msc, find mysql, and stop)
  2. Modify the my.ini file and add a newline at the end of the file: skip-grant-tables
  3. cmd enters the installation bin directory, mine is installed on the c drive. (If you don't remember where it was installed, you can find the mysql service by running services.msc and double-click to view the directory): C:\>cd "Program Files\MySQL\MySQL Server 5.7\bin"
  4. Enter the command: mysql -u root -p, when Enter password appears, press Enter directly. When mysql appears, the operation is successful.

     
  5. Input: use mysql;, output "Database changed" is successful (be careful not to drop the semicolon)
  6. Update the password to 123456, enter the command: update mysql.user set authentication_string=password('123456') where user='root'; (don't drop the semicolon, the command I entered at the beginning is: update user set password=password( "123456") where user="root"; this is wrong, an error is reported: ERROR 1054 (42S22): Unknown column 'password' in 'field list')

     
  7. Execute the following command: flush privileges; (note that the semicolon cannot be dropped)
  8. Exit, enter the command: quit;
  9. Run services.msc to start the mysql service.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326116049&siteId=291194637