mysql: Reset root password without knowing it (Mac MAMP)

Hi Folks,

sometimes funny things appear. You maybe forgot the root password of your mysql installation, or something went wrong during the installation, or ….

So here is an easy way how to reset your root password. I got it from here:

Stop the Apache and Mysql using the MAMP UI

Copy and paste the following command into a Terminal window and press enter:

/Applications/MAMP/Library/bin/mysqld_safe --skip-grant-tables --skip-networking --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/ &


When Terminal displays the following message, press enter again to return to the Terminal prompt.

mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql


At the prompt type the following command to access the MySQL command line:



You should see the MySQL command line prompt: mysql>

Type the following, replacing NewPassword with the password of your choice:

UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root';


Press enter, then type:



Press enter. Then, to quit the MySQL command line type:



You should be returned to the Terminal prompt. Type the following command to shutdown MAMP’s MySQL server. You’ll be prompted for the new root password when you press enter.

/Applications/MAMP/Library/bin/mysqladmin --socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown -u root -p


Having reset the root user password you should follow the instructions here regarding updating the necessary files in MAMP with the new password.

Thats all folks,



Comments are closed.

%d bloggers like this: