2

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.

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

Any suggestions are appreciated.

powerdown
  • 47
  • 2
  • 9

3 Answers3

0

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!

jflores
  • 483
  • 6
  • 18
  • I checked my logs both 'MAMP/logs/mysql_error_log.err' (which was blank) and 'MAMP/logs/mysql_error.log' which did not contain any errors. Also, Activity Monitor didn't show any 'mysqld' process except when MAMP was running. – powerdown Jan 02 '15 at 18:48
0

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.

DaveyJake
  • 2,361
  • 1
  • 16
  • 19
  • This was the message I got in Terminal `AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Wesley.local. Set the 'ServerName' directive globally to suppress this message Syntax OK` And I don't see a file called http.conf in my bin > apache2 folder. All I see are two aliases for bin and logs. – powerdown Apr 10 '15 at 00:23
  • Sounds like you'll need to edit your `hosts` file. Located in `/etc/`, open your `hosts` file inside TextEditor and this line at the bottom of the pre-existing text: `# 127.0.0.1 Wesley.local ` Then open your browser and try view your MAMP install. – DaveyJake Apr 10 '15 at 00:42
  • On a sidenote, if you're running MAMP `Apache`, keep your port at `:8888` with `mySQL` at `:3306`. For MAMP `NGINX`, keep your port at `:7888` with `mySQL` at `:3306` at all times. Lastly, a quick way to edit your `hosts` file would be to use `GasMask`. It's free to download from http://clockwise.ee – DaveyJake Apr 10 '15 at 00:47
0

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.

ahaurat
  • 3,947
  • 4
  • 27
  • 22