MySQL 5.7forgot your password.
Modify configuration file:
[root@MySQL-S mysql]# vim /etc/my.cnf
2. Add the following to the module [mysqld].
skip-grant-tables
3. Restart MySQL.
[root@MySQL-S mysql]# ./ support-files/mysql.server restart
4. Enter with blank password, enter.
[root@MySQL-S mysql]# mysql
Execute statements.
mysql> alter user 'root'@'localhost' identified by '123456';
6. Refresh:
mysql> flush privileges;
Or:
update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';