MAMP: Can’t find server/connect to database after Yosemite upgrade

MAMP used to work flawlessly for me while developing WordPress sites locally. Then I upgraded to Yosemite and started getting the “Can’t find Server” error in my browser (when ports are set to defaults Apache: 8888, MySQL: 8889), and then “Error connecting to database” (when ports are set to 80, 443, and 3306).

The only thing that changed was the Yosemite upgrade. So then I tried switching to MAMP Pro to see if it made a difference, which it did! But now the trial has expired and I’m back in the cold. Then I tried XAMPP and AMPPS as well but got the same issue. This was all a few weeks ago. So today I began developing a new site and decided to just register for MAMP Pro thinking I would avoid the headache and just get on with life. But now MAMP Pro is giving me same problems. I have no idea what’s going on and how to troubleshoot this.

Read More

I have tried setting wp-config host settings with “localhost:8888”, and “127.0.0.1” to no avail.

Any suggestions are appreciated.

Related posts

Leave a Reply

3 comments

  1. I had a similar problem and it sounds like I followed a similar process (a lot of similar settings, though I didn’t end up upgrading to MAMP Pro). One thing I noticed when I looked at my error log MAMP/logs/mysql_error_log.err was the following message:

    InnoDB: Unable to lock ./ibdata1, error: 35
    InnoDB: Check that you do not already have another mysqld process
    InnoDB: using the same InnoDB data or log files.  
    

    When I opened my Activity Monitor, I saw a process for mysqld that was active (even though MAMP was shut off). I’m not sure whether a previous process didn’t terminate correctly or what, but I manually quit the process, restarted MAMP, and it worked just fine. In my case, it was something small and stupid, but sometimes that’s what happens. Good luck!

  2. Launch Terminal and run the following command:

    sudo apachectl configtest

    Do you get an error message (e.g. “bad name”) or any kind of warning?

    If it’s due to a bad name, inside your MAMP folder locate bin > apache2 and open the http.conf file in TextEdit.

    Locate these 2 lines:

    User _www
    Group _www

    All you have to do is replace the User _www with the name of your home folder and the Group to staff. For example, if your home folder was named rugbyplayer, you would write this:

    User rugbyplayer
    Group staff

    Let me know if this works for you.

  3. OSX Yosemite (possibly newer versions of OSX as well) looks in the wrong location for the mysql.sock file, which may be why upgrading to Yosemite broke your local sites. Creating a symlink to the correct location will solve the problem:

    sudo mkdir /var/mysql
    sudo chmod 755 /var/mysql
    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
    

    The reason the missing symlink is a problem for WordPress specifically is because in your wp-config.php file, define('DB_HOST', 'localhost'); will not work. An alternative workaround is to change this value in your wp-config file to define('DB_HOST', '127.0.0.1');.

    Perhaps when you tried 127.0.0.1 in your wp-config file you had the incorrect ports specified in MAMP? 80, 443, and 3306 should work.