What to do if I forget the root password of mysql

First log in to MySQL.
Run command line window mysql
and then execute the command set password for ....
Format: mysql> set password for the user name @localhost = password ( 'new password');
examples: mysql> set password for root @ localhost = password ( '123');

After logging out, log in again
mysql -u root -p 123

Guess you like

Origin blog.csdn.net/vcj1009784814/article/details/108974744