How to recover mysql root password in MacOS

2020-05-07 04:51发布

问题:

I start my MAMP and try to connect to my MySQL server via localhost or 127.0.0.1, I tried all the possible password that I think it is correct, but for some reasons it still didn't like it, so I think I forgot it somehow. I need help.


Try #1

Enter all the possible passwords

MySQL -u root -h localhost -p

Enter password: <---I've tried almost 10 possible passwords

I got

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


Try #2

Enter possible passwords

MySQL -u root -h localhost

I got

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


Try #3

MySQL.server stop

I got

ERROR! MySQL server PID file could not be found!

I'm trying to run this

mysqld_safe --skip-grant-tables &

I got


Try #4

mysqld_safe --skip-grant-tables &

I got

[1] 72194