Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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??

share|improve this question
    
Are you able to login into mysql from command line with the user name and password? –  KDM Jun 20 '12 at 4:01
    
Haven't tried, I use Sequel Pro to interface with my databases. –  Joel Glovier Jun 21 '12 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 '12 at 20:53
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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. –  Joel Glovier Jun 21 '12 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 –  Joel Glovier Jun 21 '12 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. –  Joel Glovier Jun 24 '12 at 16:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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