Ed's Big Plans

Computing for Science and Awesome

MAMP Solution: “Access denied for user ‘root’@’localhost’”

without comments

Thanks to Josee for writing up the full symptoms here.

Brief Symptoms

After upgrading MAMP and changing the root password, the MAMP GUI reports an error 1045. This amounts to the binary “/Applications/MAMP/Library/bin/mysqlcheck” being unable to connect to the MySQL DB since the password has changed.

This solution is related only to the GUI, and not the PHP files in phpMyAdmin, I assume your PHP already have your changed passwords.

(Note, while Josee upgraded from 1.7.2 to 1.8.4, I upgraded from 1.7.2 to 1.9 — we both report that this fix works for our current versions.)

Solution

Go into “/Applications/MAMP/bin” (or substitute whatever path you have to the equivalent directory).

Notice that there are plenty of “.sh” bash script files in this directory– at least one of them is causing the error; to be safe, we will edit every file that refers to the root password. The following script files call the binary “Library/bin/mysqlcheck” change the “-proot” argument to “-p<password>” where “<password>” is your password, save your changes:

checkMysql.sh
quickCheckMysqlUpgrade.sh
repairMysql.sh

The following script calls the binary “Library/bin/mysql_upgrade” make the same change, save.

upgradeMysql.sh

The following script calls the binary “Library/bin/mysqladmin” make the same changes, save.

stopMysql.sh

Quit MAMP and restart it– the error should be gone.

Notes

The following script calls the binary “Library/bin/mysql_safe” and does not specify a password, no need to touch this file at all.

startMysql.sh

I actually started to solve this problem by making use of the error message– it’s reported that the binary “Library/bin/mysqlcheck” couldn’t check the database– so, I literally searched for that string in the MAMP folder– after I discovered the first three files had to be edited, I looked for the string “-proot” to figure out if there were any other files that needed editing.

That’s all! Enjoy!

Written by Eddie Ma

April 27th, 2010 at 11:37 am

Posted in Website Management

Tagged with , ,

Leave a Reply