• Hello everyone,

    look, I’m sure that my question has already been asked a trillion times on the web, but being a complete newbie on database management, php and all of that, I’m quite lost between this myriad of solutions. So please bear with me, I promise I won’t bother you for long.

    My error message comes when I try to install WordPress. I have the famous “Error establishing a database connection” that comes after I am prompted to enter my credentials. Using MAMP for the Apache / MySQL side of the thingie, I tried to reset my password using the query command “SET PASSWORD FOR”. However, now that I’ve changed it, it won’t let me access anymore, saying that “phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server”.

    So here are my two questions : First of all, how can I modify my admin credentials to have access again to phpMyAdmin? I’ve been trying to tinker through the files of my MAMP installation, but I found nothing useful. And after that, what alternative do I have to fix my original issue, which means the error with the database connection?

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    When you click the “Open WebStart page” button from the MAMP app, does it show your new password, or your old password under the “MySQL” heading on the left side of the page? If it displays your old password, you could try modifying this file: Applications/MAMP/bin/phpMyAdmin/config.inc.php Around line 87 you’ll see a line for the MySQL password – change that to your new password, save the file, refresh the MAMP homepage, and try clicking on the phpMyAdmin link again. Just make sure to backup that config.inc.php file before you make changes, just in case that’s not the right solution.

    Thread Starter artolom

    (@artolom)

    Thanks for your answer! As you said, the displayed password was my old one, so I tried to modify it on the confing.inc.php file. Unfortunately, I still can’t access the phpMyAdmin page. Is there any other file that could lead to this error?

    When you tried modifying that config.inc.php file, after you reloaded the MAMP landing page did it then show your new updated password on the left side of the page or was it still displaying your old password? That could help determine if that’s the right configuration file that the MAMP app is looking for. Maybe try clearing your browser cookies and cache before reloading the page to see if that helps?

    What I’m thinking is that when you ran the queries to reset the password, that was within MySQL itself. So the password there is changed. MAMP just needs to be clued in to what the new password is that it needs to send to the database server in order to connect to the database. When I modified the Applications/MAMP/bin/phpMyAdmin/config.inc.php file on my localhost as a test, that would either grant or deny me access to the database depending on if I had the correct or incorrect password in that file. There could be another file or something that needs to be modified that I don’t know about, too, though.

    Try clearing your cache and cookies and then checking the landing page to see if it displays your updated password after updating that file. If that doesn’t work, I’ll keep digging around to see if I can find anything else! Maybe someone else will chime in with their experience, as well.

    Oh, also… once you get your MAMP/phpMyAdmin working correctly again, check the wp-config.php file in your WordPress directory and make sure the username and password in there is correct. That could resolve your original “Error establishing a database connection” when trying to install WordPress. (On my localhost install, the file is in /Applications/MAMP/htdocs/wordpress/wp-config.php Yours might be different depending on how you set up your directories.)

    Thread Starter artolom

    (@artolom)

    Thanks for your trick! I can finally get access to phpMyAdmin now ??

    However, I tried to look into the file you specified for the database connection error, but I do not find any wp-config.php file in my WordPress directory. The only one I have is a wp-config-sample.php. Should I create it myself?

    That’s great! ??

    My wp-config.php file was automatically created for me, but it looks like you could create the file yourself. Here are some instructions I found that might be helpful: https://codex.www.ads-software.com/Installing_WordPress#Step_3:_Set_up_wp-config.php

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Database connection with MAMP’ is closed to new replies.