Can't connect to mysql from php
Posted on 2006-03-27
I installed apache-2 (2.2.0), mysql 5.0.19 and php (4.4.2) on RH. Apache and PHP are compiled from source, apache is working, mysql is working from the command line and php is working. But I can't connect to mysql from php. The error is "Can't connect to local MySQL server through socket '/var/tmp/mysql.sock'..."
The msyql.sock file exists (srwxrwxrwx 1 mysql mysql 0 Mar 27 20:16 mysql.sock) and php was compiled with
The php statement is valid: mysql_connect('localhost', '[user]', '[password]') or die('Could not connect: ' . mysql_error()); and that user /password works from the command line.
What am I doing wrong?