homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Can't connect to local MySQL server through socket

Msg#: 4279206 posted 11:09 pm on Mar 9, 2011 (gmt 0)

Hi all !

I'm running a vbulletin forum for 10 years now.
Suddently, i started to get problems with MySQL, getting tons of emails giving this error:

mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Anyway to fix this permanently ?
don't know what to do....




WebmasterWorld Senior Member lammert us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4279206 posted 8:06 pm on Mar 10, 2011 (gmt 0)

Did you check if the file /var/lib/mysql/mysql.sock exists? List the directory with the following command:

ls -ladF /var/lib/mysql/mysql*

The result should be this:
drwx------ 2 mysql mysql 4096 Apr 4 2010 mysql/
srwxrwxrwx 1 mysql mysql 0 Jan 7 00:16 mysql.sock=

Sometimes the mysql.sock doesn't exist because it has been erased accidentaly, and sometimes it is not a socket but a normal file. In that case the = is missing at the end of the file name with this specific directory listing command. If it is a file, deleting that file and restarting the MySQL server should do the trick.

You should also check if there has been a recent update of MySQL on your server which changed your my.cnf file. That file should at least contain the following lines:

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved