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:

/Applications/MAMP/bin/phpMyAdmin-X.X.X/config.inc.php

There’s the line that reads

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

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

/Applications/MAMP/bin/mamp/index.php

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

/Applications/MAMP/bin/stopMySQL.sh

>> 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.

%d bloggers like this: