mysql5.7 forget the root password

1, edit my.cnf file

Increase the line skip-grant-tables in the mysqld configuration, remove the Password Authentication Database

Restart mysql

2, an input command mysql login to update mysql.user set authentication_string = password ( '123456') where user = 'root';

3, the refresh permission to flush privileges;

4, edit the configuration file to increase password authentication, restart mysql

Guess you like

Origin www.cnblogs.com/tiantianhappy/p/11634816.html