Change MAMP MySQL password

MAMP creates a local server environment on Mac OS X by installing Apache, PHP and MySQL right out of the box.

The default username/password for MySQL install is root/root. That’s not safe. For security purposes, in our case we want sync between our WAMP and MAMP , it’s best to change that.

Open the Mac OS Terminal Application (located in “/Applications/Utilities”) and enter the following line

/Applications/MAMP/Library/bin/mysqladmin -u root -p password [NewPassword]

>> replace [NewPassword] with new password.
It will ask for the current password after you hit enter. Once you’ve entered that, the MySQL password is changed

Not over yet, open a text editor and change the password in the following files:


There’s the line that reads

$cfg['Servers'][$i]['password'] = 'root'

>> change the value ‘roor’ to the new password, retaining the quotes


There’s the line that reads

$link= @mysql_connect('/Applications/MAMP/tmp/mysql/mysql.sock','root','root'); ;

>> change the last parameter to the new password


>> replace the -proot with the new password.
Note: if we don’t change this one, we can have zombie mysqld’s running after you thought you stopped the server.