faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

68 of 161 people (42%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

Why I get this Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'(111) /path/a.php3

Jun 23rd, 2000 14:20
Barry Munro, Henrik Hansen, Deepak Joglekar, Ben Udall, http://www.php.net/manual/function.mysql-pconnect.php


Are you 100% sure your mysql server is running on your local box?
Are you sure your are using the right port?
If it's none of these then it could be that the mysql.sock file is in a 
non-standard place on the machine (on a server I recently used it was 
in /tmp/mysql.sock). To get over this find out where it is (find / -
name "mysql.sock" -type f) and then pass this in the (p)connect 
function:
mysql_pconnect(hostname:port:/path/to/mysql.sock, username, password);