Skip to content

August 20, 2011

OS X Lion, MySQL and WordPress

by Andreas Schaefer

Today I wanted to create a local copy of a remote WordPress blog / site and stumbled over some nasty business with PHP and MySQL. I am not sure how is at fault (probably Apple) but I am not 100% sure.

After exporting the site, installing MySQL and creating the wordpress user and DB schema I was ready to install WordPress. So I extracted wordpress, copied into /Library/Web/Data/Site/Default and opened http://localhost/wordpress on my Safari browser. After telling wordpress to create the configuration file I entered the necessary data (schema name, user name, password etc) and hit submit. But I got an error page that it could not connect to the DB. After triple checking the settings I started to google around. After some time I eventually hit this site: http://bustoutsolutions.com/blog/2011/07/29/wordpress-error-establishing-a-database-connection-after-upgrading-to-os-x-lion which told me to look into the /etc/php.ini file and make sure that the mysql.default_socket setting was correct. It was set to /var/mysql/mysql.sock but it turned out that wasn’t the case. So I checked again and found (as said in the blog entry) it under /tmp/mysql.sock. Changing that and creating the wp-config.php file by hand I was able to pass by the setup.

After installing the wordpress-importer plugin I was told it could not create the uploads directory under wp-content and after creating it and set the permission to 777 I was able to import the site.

Not sure what happened because I could install the blog you are reading now without any issues and without changing the php.ini file. Really strange.

– Andy

Read more from Uncategorized

Comments are closed.