MySQL root user password change in MAMP

Recently I installed MAMP on my Mac (XAMPP equivalent on PC) for a local testing server environment development and came to know that the user and password both are root by default. As I am a newbie on this server and database environment, I wanted to change the user and password. So just like I have done on PC beore, I went ahead and changed the password on phpMyAdmin page. Big mistake!! The whole thing got messed up.

After some digging on web, I found a few posts on how to change root password of MySQL (here) and here . But when I tried changing MySQL root password on command prompt MySQL did not respond at all. There is not enough instructions on MAMP’s site. However I found out another blog post which has described how to fix it in detail here.  However, for changing the root password the following command did not work.

/Applications/MAMP/Library/bin/mysqladmin -u root -p password

I do not know whether it is due to OS-X Lion.

But following step fixed the password.

Start MAMP server and log into MySQL. Use the following command to change the password:

$ mysqladmin -u user -p oldpassword password newpassword

Here comes the important step. You need to change the old password occurrences in a bunch of files present in bin folder of MAMP Library.

Following are the files needed to be changed from -u root -proot to -pnewpassword






And two important files

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

$port = '3306';
$link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'user', 'newpassword');

File: Applications/MAMP/bin/phpMyAdmin/

$cfg['Servers'][$i]['user']          = 'user';      // MySQL user
 $cfg['Servers'][$i]['password']      = 'newpassword';          // MySQL password (only needed
 // with 'config' auth_type)

These fixed my password setup problems.

One thought on “MySQL root user password change in MAMP

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>