MySQL socket file relocated in Tiger
I just finished fixing the blog and forums of one Doctor Pantzo, unleashing no doubt a fury of obscenities upon an unsuspecting galaxy. Here’s how.
For whatever reason, MySQL’s socket file in Tiger no longer lives at /var/mysql/mysql.sock, but at /tmp/mysql.sock. This wreaks minor havoc with things like Wordpress and phpBB, because PHP’s mysql extension assumes the incorrect location for the file. The main symptom is a failure to connect to the database. Wordpress unhelpfully suggests that you check your username and password, while phpBB just dies with a lot of php mysql_connect barf.
The solution seems to be to specify the socket file path as part of the database hostname when configuring these (and other) applications, since most will pass the hostname you specify directly to mysql_connect(), which will take it as a valid parameter.
For Wordpress, change DB_HOST in wp-config.php like this:
define('DB_HOST', 'localhost:/tmp/mysql.sock');
For phpBB, change $dbhost in config.php like this:
$dbhost = 'localhost:/tmp/mysql.sock';
More about this is on the Wordpress support forums.
March 21st, 2006 at 9:39 pm
Yo, Johnny B! You rock! Thanks for fixing my site!
March 22nd, 2006 at 2:06 am
Word.