Welcome! Log In Create A New Profile Forum Rules

Advanced

db access denied with MAMP 1.8.4

Posted by Josee 
db access denied with MAMP 1.8.4
five months ago
Hello,

I recently installed MAMP 1.8.4 (in replacement of MAMP 1.7.2) and I'm having problems accessing MySQL once I've changed the root user's password. I've tried several times, and every time the result is the same, so I must be forgetting something! Here is how I proceed:

• in Terminal I first type
/Applications/MAMP/Library/bin/mysql -u root -p
and enter the 'root' password.

• Then I change it typing this:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');

• I type 'exit' and connect again with the new password, it works fine.

• I change the password in MAMP/bin/phpMyAdminForPHP5/config.inc.php, changing this line:
86 $cfg['Servers'][$i]['password'] = 'newpassword';

• I quit MAMP and launch it again and at that point I can no longer access MySQL (I've tried quitting MAMP before I change the config. file, but the result is the same). Here is the error message:
Checking MySQL databases failed
Error message:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: 
Access denied for user 'root'@'localhost' (using password: YES) 
when trying to connect
Yet, in Terminal, I can still access MySQL and get the list of databases with the new password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.37 Source distribution

• I've tried shutting down my Mac and starting again, emptying the browser's cache, throwing away MAMP and starting everything again with a new install, but no change!

Is there another config file somewhere that I should change?

With thanks for your help,

Josee
Local server: MAMP version 1.8.4
PHP Version 5.2.11
MySQL version: 5.1.37 Source distribution
phpMyAdmin - 2.11.9.5 & phpMyAdmin 3.2.0.1
Apache 2.0.63
Workstation OS: Apple 10.6.2 on Intel Mac
Re: db access denied with MAMP 1.8.4
five months ago
I had similar problem. I had to change the password in the MAMP PRO "Server" control panel.
MySQL root password: "Change MySQL root password" button.
Stopped the database and restarted and everything started working again.
Re: db access denied with MAMP 1.8.4
five months ago
There are my.cnf and my.ini configuration files that may or may not exist. Just to be clear, though, when you say you start MAMP and then can't connect to MySQL, where and how do you mean you can't connect (because you can in the Terminal)?

Best Wishes,
Larry

Writer/Web Developer/Instructor
Forum Moderator
Re: db access denied with MAMP 1.8.4
five months ago
Thanks to both of you.

Quote
Larry
when you say you start MAMP and then can't connect to MySQL, where and how do you mean you can't connect

Normally, when I click on the MAMP icon in the Dock, it should open PhpMyAdmin in the browser. That's what used to happen before I changed the password. With the new password, I get instead this error message in MAMP
Checking MySQL databases failed
Error message:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: 
Access denied for user 'root'@'localhost' (using password: YES) 
when trying to connect

and this error message in the browser:
Error: Could not connect to MySQL server!

Quote
Brickster
I had similar problem. I had to change the password in the MAMP PRO "Server" control panel.
MySQL root password: "Change MySQL root password" button.
Stopped the database and restarted and everything started working again.

This "half" works for me: I was able to change the password as you explain, and I do access phpMyAdmin thanks to MAMP Pro, but when I quit MAMP Pro and launch MAMP again, I still get the error messages.

The only thing I noticed thanks to your "trick" was that when I try to launch MAMP, the address where I get the error message is
Quote

http:// localhost:8888/MAMP/?language=French

whereas when I launch MAMP Pro and it opens phpMyAdmin, the address is:
Quote

http:// localhost:8888/phpMyAdminForPHP5/?lang=en-iso-8859-1&language=English

So I've changed the default URL in the Preferences to
Quote

localhost:8888/phpMyAdminForPHP5
and now when I launch MAMP I do access phpMyAdmin… but MAMP is unhappy all the same and keeps showing the same error message:
Checking MySQL databases failed
Error message:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: 
Access denied for user 'root'@'localhost' (using password: YES) 
when trying to connect

Well, I can live with the error message, as long as I can access phpMyAdmin, but I would really like to understand what's happening!

Josee
Local server: MAMP version 1.8.4
PHP Version 5.2.11
MySQL version: 5.1.37 Source distribution
phpMyAdmin - 2.11.9.5 & phpMyAdmin 3.2.0.1
Apache 2.0.63
Workstation OS: Apple 10.6.2 on Intel Mac
Re: db access denied with MAMP 1.8.4
five months ago
Well, on the simple level, the username/password/host combination being used by phpMyAdmin does not have authority to connect to MySQL. Perhaps you didn't edit the right file or the right line? There are two phpMyAdmin installs with MAMP.

Best Wishes,
Larry

Writer/Web Developer/Instructor
Forum Moderator
Re: db access denied with MAMP 1.8.4
five months ago
Thank you for your answer, Larry.

I edited line 86:
line 84 — $cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
line 85 — $cfg['Servers'][$i]['user']          = 'root';      // MySQL user
line 86 — $cfg['Servers'][$i]['password']      = 'newpassword';          // MySQL password (only needed
                                                    // with 'config' auth_type)

in the file called "config.inc.php" in the "MAMP/bin/phpMyAdminForPHP5" repertory, and just in case (of what, I don't know!), when I saw I still had problems, I also edited the file in the "phpMyAdminForPHP4" repertory…

I think I'm editing the right file because this is the sixth or seventh time I do it (I have to do it both on my iMac and my laptop), and every other time, it worked. But obviously, I must be missing something else, somewhere!

Josee
Local server: MAMP version 1.8.4
PHP Version 5.2.11
MySQL version: 5.1.37 Source distribution
phpMyAdmin - 2.11.9.5 & phpMyAdmin 3.2.0.1
Apache 2.0.63
Workstation OS: Apple 10.6.2 on Intel Mac
Re: db access denied with MAMP 1.8.4
five months ago
Hey Josee,

I'm sorry if this one fell through the cracks. I don't know if I have any better answer for you, but do you still need help with this?

Best Wishes,
Larry

Writer/Web Developer/Instructor
Forum Moderator
Re: db access denied with MAMP 1.8.4
five months ago
Thanks for asking! The situation is still the same, but as I said previously I can live with it. There's still an error message the first time I launch MAMP, but it doesn't prevent me from using it. If some day I find the reason why, I'll post the answer!

With thanks for your help,

Josee
Local server: MAMP version 1.8.4
PHP Version 5.2.11
MySQL version: 5.1.37 Source distribution
phpMyAdmin - 2.11.9.5 & phpMyAdmin 3.2.0.1
Apache 2.0.63
Workstation OS: Apple 10.6.2 on Intel Mac
Re: db access denied with MAMP 1.8.4
five months ago
Okay. Thanks for the update! Glad to hear you can still function with it and do let us know if you encounter the fix.

Best Wishes,
Larry

Writer/Web Developer/Instructor
Forum Moderator
Re: db access denied with MAMP 1.8.4
four months ago
Had the same problem.

Solution found.

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.

(NOTE: "startMysql.sh" calls the binary "Library/bin/mysql_safe" and DOES NOT specify a password, no need to touch this file at all.)

I'll have to add an entry to my blog about this later :D

- Eddie Ma
[eddiema.ca]

P.S. -- 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 been edited, I looked for the string "-proot" to figure out if there were any other files that needed editing.
Re: db access denied with MAMP 1.8.4
four months ago
Many thanks, Eddie. It worked for me too.

I had tried this already, but I had only modified the checkMysql.sh that was mentioned in the error message. Obviously, it's not enough. Stupid of me not to have checked the other shells at the time!

It had really become irksome to have this error message every day, so thanks again!

Josee
Local server: MAMP version 1.8.4
PHP Version 5.2.11
MySQL version: 5.1.37 Source distribution
phpMyAdmin - 2.11.9.5 & phpMyAdmin 3.2.0.1
Apache 2.0.63
Workstation OS: Apple 10.6.2 on Intel Mac
Re: db access denied with MAMP 1.8.4
four months ago
That seems unfortunate that you'd have to do that but kudos for figuring it out and thanks for posting the solution!

Best Wishes,
Larry

Writer/Web Developer/Instructor
Forum Moderator
Sorry, only registered users may post in this forum.

Click here to login