mysql's solution to forgetting your password

  • 2020-05-06 11:48:16
  • OfStack

Close method:
service   mysqld   stop
Or
killall   -TERM   mysqld

Next, restart mySQL by adding the command
/usr/bin/safe_mysqld   --skip-grant-tables   &
Note the path of the program. Replace it with your path
Then launch mySQL and type: mysql
in command mode   mysql   > use   mysql
> update   user     password=password(" new password ")   where   user="root";
> flush   privileges;
> exit;

Close mySQL now executing and restart mySQL as normal.

Launch the mysql command:
mysql   -h   localhost   -uroot   -p
password
- >

Related articles: