The Community Forums

Interact with an entire community of cPanel & WHM users.
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Discussion in 'Database Discussions' started by neomas, May 2, 2008.

  1. neomas

    neomas Registered

    Joined:
    Apr 4, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I don't know how to solve error

    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

    when i restart SQL Server (MySQL) on WHM
    it's error

    /usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)'
    Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
    mysql has failed, please contact the sysadmin (result was "mysql has failed").
     
  2. Stephanie_R

    Stephanie_R Active Member

    Joined:
    Mar 1, 2004
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Sounds like something ate your symlink in /tmp

    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

    restart MySQL
     
  3. neomas

    neomas Registered

    Joined:
    Apr 4, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I try to solved and fixed everything but still same.
    :mad: I don't know how to solve about this problem.

    pls. help me.
     
  4. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA
    /scripts/restartsrv_mysql

    if that doesn't work.

    /scripts/mysqlup --force
     
  5. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,430
    Likes Received:
    19
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Also try

    /scripts/mysqlconnectioncheck
     
  6. romyloice

    romyloice Registered

    Joined:
    Apr 6, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bandung
    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock

    Same with me..

    Mine :
    WHM 11.15.0 cPanel 11.18.5-R24173
    CENTOS Enterprise 5 x86_64 on standard - WHM X v3.1.0

    /scripts/mysqlup --force
    completed, but still have the same problem..
    error message :
    /usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists! mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").

    checking /var/lib/mysql/mysql.sock does not exist.. :(

    /scripts/mysqlconnectioncheck gives nothing..

    Any clue ??
     
    #6 romyloice, May 7, 2008
    Last edited: May 7, 2008
  7. shital

    shital Member

    Joined:
    May 28, 2007
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Did you check the partition size on file system?? I mean may be /var is 100% full on server. Thats the reason mysql could not be started on server.

    MySQL sock file not found
    ====================

    = killall -9 mysqld
    = service mysql stop
    =cp var/lib/mysql/mysql.sock var/lib/mysql/mysql.sock_backup
    = rm -f /var/lib/mysql/mysql.sock
    = service mysql start
    = ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
    = /scripts/restartsrv mysql

    Hope this will help you to resolve this issue as it helps me always :)

    Shital
     
  8. Bigwebmaster

    Bigwebmaster Member

    Joined:
    Dec 3, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Try and open up your /etc/my.cnf file and see if you can find this:

    Code:
    [mysql.server]
    user=mysql
    basedir=/var/lib
    
    Comment out the basedir variable so that it looks like this:

    Code:
    [mysql.server]
    user=mysql
    #basedir=/var/lib
    Then try and restart mysql and see if that fixes it.
     
  9. FourMat

    FourMat Active Member

    Joined:
    Jun 10, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Can someone tell me why this works?

    I just made that change and now my mysql server is up and running after having the same problem as the original poster.....
     
  10. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,430
    Likes Received:
    19
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The basedir directive instructs MySQL where to find everything it needs to function: binaries, libraries, data, etc. Hence by stipulating basedir=/var/lib, MySQL will search /var/lib for everything needed to perform its functions.

    For typical installs via RPM, this directive is not needed and should not be used. For a more exhaustive description of this directive, please consult the MySQL manual.
     
  11. FourMat

    FourMat Active Member

    Joined:
    Jun 10, 2004
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the info. I am trying to get this newly configured server up and running and was a little surprised to find that the mysql server wasn't working out of the box.

    Thanks for the help!
     
  12. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,430
    Likes Received:
    19
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Nothing in cPanel adds the basedir directive to /etc/my.cnf, which means it was added by something/someone outside cPanel's functions.
     
  13. bhstudios

    bhstudios Member

    Joined:
    Jul 26, 2007
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chile - SCL
    Excellent contribution, i was totally lost tried evrything, only think that worked was this, thanks FourMat :D
     
  14. samomania21

    samomania21 Registered

    Joined:
    Jun 15, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Restart the mysql server

    sometimes, during load up the server might not start. the following worked for me. RESTARTING THE MYSQL SERVER

    /etc/init.d/mysqld restart
     
Loading...

Share This Page