MySQL Forums
Forum List  »  Install & Repo

Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Posted by: Jan Jaderný
Date: March 23, 2007 07:07AM

I have the same problem and it drives me almost crazy...

I´m running CentOS 4.4 with rpm apache - httpd-2.0.52-28

I NEED mysql 4.0.x (especially I NEED to use 4.0.27) and php, eg. 4.3.9.
I compiled both without problems, configured both and set this in my.cnf:
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock

When I run "mysqld_safe start" (under root, mysql, it doesn´t matter), it works all fine until I try to use mysql_connect() in PHP... Then I get:
mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
But this socket exists at the time and have permissions rwxrwxrwx!!! So why the heck it does´t connect?

When I run mysql from command line with --socket=/tmp/mysql.sock option, it works fine! So why PHP doesn´t work???

If someone has an idea, please write it here...

Options: ReplyQuote


Subject
Written By
Posted
January 08, 2009 02:01PM
Re: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
March 23, 2007 07:07AM
April 15, 2009 11:56AM
October 21, 2009 06:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.