Wordpress “error establishing a database connection” on OS X Leopard
Posted on December 13th, 2007 by JeffIf you are getting this error on your local WordPress installation using Mac OS X Leopard, there is a simple fix. You might be seeing this error even though PHP is working fine, and MySQL is working fine. In order to get WordPress to work create a php.ini file.
sudo cp /private/etc/php.ini.default /private/etc/php.ini
Change permissions and edit the file
sudo chmod 777 /private/etc/php.ini
vi php.ini
Change mysql.default_socket = [blank] to
mysql.default_socket = /private/tmp/mysql.sock
Restart Apache and you should be good to go!







Thanks, that worked like a charm!
Posted at 7:18 pm on December 18th, 2007Hey thanks you!
Posted at 1:52 pm on January 9th, 2008Cool… can you edit php.ini with pico? It makes more sense to me.
I’m on 10.4 but am going to give it a try… thanks for the tip!
Posted at 1:28 pm on March 3rd, 2008[...] From : http://bustoutsolutions.com/blog/2007/12/13/wordpress-error-establishing-a-database-connection-on-os... [...]
Posted at 9:06 am on March 20th, 2008How effective has wordpress been on Mac? I have not heard alot about its use on Mac.
Posted at 2:33 pm on March 25th, 2008@Wordpress Themes, It doesn’t matter if you’re running a Mac or a PC or anything else for that matter, as long as you have the correct versions of PHP and MySQL. See http://wordpress.org/about/requirements/ for more info.
Posted at 9:23 am on March 26th, 2008What does that mean? Lol.
Posted at 10:14 am on April 3rd, 2008Yes, that works, but don’t chmod 777; you end up giving anyone the right to edit that file and possibly hack parts of your system. Just set the “mysql socket” line mentioned.
Posted at 10:44 am on May 2nd, 2008Yes, that works, but don’t chmod 777; you end up giving anyone the right to edit that file and possibly hack parts of your system. Just set the “mysql socket” line mentioned. There shouldn’t even be a “7″ anywhere in those permissions.
Posted at 10:47 am on May 2nd, 2008Brilliant, worked perfectly. and even better, you were the first hit in google
Posted at 1:54 am on May 16th, 2008