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: Cam Blair
Date: April 03, 2007 10:49AM

I have the same issue:

running redhat 4 with XAMPP installed and working. I can use the phpmyadmin that comes with lampp to manage mysql...I can also start and stop mysql just fine from the terminal window. I can login as root to it just fine too, but when any of my perl scripts try to connect, it spits out the "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

I have the following setup in my.cnf:

[mysqld]
datadir=/opt/lampp/var/mysql
socket=/opt/lampp/var/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/opt/lampp/var/lib

[client]
socket=/opt/lampp/var/mysql/mysql.sock

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Can someone tell me what I am missing as well? I haven't tried getting any my php scripts to connect for testing purposes other than using phpmyadmin that came with lampp.

I have been fighting this for two days and am totally stumped now.

Thanks!

EDIT -- I figured out my problem...I had an invalid reference in the my.cnf file...I changed the following from the above example:

[mysql.server]
user=mysql
basedir=/opt/lampp/var/mysql -- this was pointing to /opt/lampp/var/lib

once that got changed, it all works great!!!



Edited 1 time(s). Last edit at 04/03/2007 11:29AM by Cam Blair.

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)
April 03, 2007 10:49AM
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.