Results 1 to 14 of 14

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

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    4

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

    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. #2
    Registered Member Stephanie_R's Avatar
    Join Date
    Mar 2004
    Posts
    36

    Default

    Sounds like something ate your symlink in /tmp

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

    restart MySQL

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    Angry

    I try to solved and fixed everything but still same.
    I don't know how to solve about this problem.

    pls. help me.

  4. #4
    Registered Member rpmws's Avatar
    Join Date
    Aug 2001
    Location
    back woods of NC, USA
    Posts
    1,852

    Default

    Quote Originally Posted by neomas View Post
    I try to solved and fixed everything but still same.
    I don't know how to solve about this problem.

    pls. help me.
    /scripts/restartsrv_mysql

    if that doesn't work.

    /scripts/mysqlup --force
    Just keeping my "eye" on things....
    R. Paul Mathews
    RPMWS - diehard cPanel Nutcase

  5. #5
    cPanel Development cPanelKenneth's Avatar
    Join Date
    Apr 2006
    Posts
    4,284
    cPanel Access Level

    Root Administrator

    Default

    Also try

    /scripts/mysqlconnectioncheck

  6. #6
    Registered User
    Join Date
    Apr 2007
    Location
    Bandung
    Posts
    1

    Default 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 ??
    Last edited by romyloice; 05-07-2008 at 11:07 PM.

  7. #7
    Registered Member shital's Avatar
    Join Date
    May 2007
    Posts
    11

    Default

    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. #8
    Registered Member Bigwebmaster's Avatar
    Join Date
    Dec 2003
    Posts
    20

    Default

    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. #9
    Registered Member
    Join Date
    Jun 2004
    Posts
    34

    Default

    Quote Originally Posted by Bigwebmaster View Post

    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.
    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. #10
    cPanel Development cPanelKenneth's Avatar
    Join Date
    Apr 2006
    Posts
    4,284
    cPanel Access Level

    Root Administrator

    Default

    Quote Originally Posted by FourMat View Post
    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.....
    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. #11
    Registered Member
    Join Date
    Jun 2004
    Posts
    34

    Default

    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. #12
    cPanel Development cPanelKenneth's Avatar
    Join Date
    Apr 2006
    Posts
    4,284
    cPanel Access Level

    Root Administrator

    Default

    Quote Originally Posted by FourMat View Post
    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!
    Nothing in cPanel adds the basedir directive to /etc/my.cnf, which means it was added by something/someone outside cPanel's functions.

  13. #13
    Registered Member
    Join Date
    Jul 2007
    Location
    Chile - SCL
    Posts
    18

    Smile

    Quote Originally Posted by FourMat View Post
    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.....
    Excellent contribution, i was totally lost tried evrything, only think that worked was this, thanks FourMat

  14. #14
    Registered User
    Join Date
    Jun 2010
    Posts
    1

    Default 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

Similar Threads

  1. Replies: 13
    Last Post: 06-15-2010, 04:31 PM
  2. Replies: 2
    Last Post: 06-22-2009, 08:30 AM
  3. Replies: 1
    Last Post: 04-21-2007, 01:23 AM
  4. Replies: 0
    Last Post: 06-27-2004, 02:53 AM
  5. '/var/lib/mysql/mysql.sock' (111)
    By nas9 in forum General Discussion
    Replies: 12
    Last Post: 08-25-2003, 12:30 PM
bargain