mysql password wrong, and set passwords

1. lose a few times, passwords are wrong, forgotten. . .

2. Edit the mysql installation folder (D: \ mysql-5.7.26- winx64) under the my.ini file, mysqld enter the next label Skip-Grant-the Tables , literally: Skip - Authorization - table, remember to " save "

3. Restart mysql, under Linux (/etc/inint.d/)  Service mysqld restart , under windows (Run as Administrator cmd)  NET STOP MySQL     NET Start MySQL

4. do not enter a password, you can enter the database, use MySQL

The password reset, Update User SET password = password ( '123456') WHERE User = "the root";

   Wrong, then go to the next table structure

 

  Indeed there is no password field, go to the next check, to modify authentication_string field

  update mysql.user set authentication_string=password('123456') where user='root';

  flush privileges;   effective immediately

6. Return the last recovery (just like playing the same cube), under the sentence before removing the my.ini file, and then restart mysql, and finally try not to lose the password and lose the password, look OK yet? OK.

Guess you like

Origin www.cnblogs.com/likaixin/p/11372746.html