0

I just got a new Macbook Air and I've been manually migrating my files and code over from my old Macbook (instead of using Migration Assistant, to avoid bringing cruft).

I had several sites running Wordpress locally (on my old Macbook), as well as several sites running just statically with no CMS.

I think I've gotten Apache and MySQL all configured (installed MySQL on the new Mac with Homebrew, and using Sequel Pro to admin it) correctly, but I keep getting the "Error establishing a database connection" for all of my Wordpress sites.

The static sites are running on their local domains just fine, so that's why I think I have Apache and relevant files set up correctly (hosts, httpd.conf, httpd-vhosts.conf all just copied over from the old machine). And, I have the wp-config.php files matched up correctly with the MySQL db's, users and pw's.

So what on earth am I missing that's giving me this error on all my Wordpress installs??

3
  • Are you able to login into mysql from command line with the user name and password? Jun 20, 2012 at 4:01
  • Haven't tried, I use Sequel Pro to interface with my databases. Jun 21, 2012 at 12:18
  • The most useful way to debug this error is to open wp-config.php and add the following line: define('WP_DEBUG', true);
    – Dewayne
    Oct 29, 2012 at 20:53

2 Answers 2

1

Never used SequelPro but in phpMyAdmin sometimes when I create the database I forget to select localhost from the drop down selection. If you just type it into the text field it doesn't work, you have to select localhost from the dropdown.

Ever used XAMPP? I highly recommend it, it's an all in one package.

3
  • No, I haven't used XAMPP. I have MAMP installed on my box but haven't used it yet. May try that. I'll look to see if there's an equivalent for the localhost suggestion in SequelPro. Thanks. Jun 21, 2012 at 12:19
  • Interestingly, now I can't even log into Sequel Pro via socket. It's telling me that the socket is not found: cl.ly/HYj1 Jun 21, 2012 at 12:52
  • Okay, the socket error was because I didn't have sqlserver running. Hah! Now that I started it, I can login to Sequel Pro, but still getting the error message. Jun 24, 2012 at 16:29
0

Turns out the issue was twofold:

1) Although I had updated the mysql default socket location from /var/mysql/mysql.sock to /tmp/mysql.sock, once in php.ini, there were apparently two statements for this in the file (not sure why) and the second was still overwriting the first. So I just changed the second to the /tmp/mysql.sock value as well.

2) For whatever reason, the user I had setup for Wordpress and password were not being given access to the database. So in wp-config.php I ended up just setting the user to root for my local dev purposes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.