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.

'/var/lib/mysql/mysql.sock' (111)

Discussion in 'General Discussion' started by nas9, Jun 22, 2003.

  1. nas9

    nas9 Member

    Joined:
    May 16, 2002
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    The below error messahe started to show on my site :

    --------------------------------------------------
    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /home/user/public_html/quiz/index.php on line 4
    MySQL Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
    ----------------------------------------------------


    ,please help me solve this problem:


    Thank you very much,

    cPanel.net Support Ticket Number:
     
  2. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    service mysql stop
    rm -f /var/lib/mysql/mysql.sock
    service mysql start
    ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

    cPanel.net Support Ticket Number:
     
  3. nitromax

    nitromax Well-Known Member

    Joined:
    Feb 12, 2002
    Messages:
    189
    Likes Received:
    0
    Trophy Points:
    16
    I had this problem too. I had been running MySQL 4 for over a month with no problems. Then I updated to WHM 7.1.0 cPanel 7.1.0-R20. Still no problems at this point. Then I updated /scripts/easyapache to the July 1st build. At that point MySQL gave me the error reported above.

    Then after trying some of the suggestions the error changed to this:

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


    I followed the directions in all of the related posts and nothing seemed to work for me. So here is what I did to finally make it work:

    I read a post at the RackShack forum that the following needed to be in the /etc/my.cnf file:

    [mysqld]
    set-variable = max_connections=500

    [client]
    port = 3306
    socket = /tmp/mysql.sock
    [mysqld]
    port = 3306
    socket = /tmp/mysql.sock


    I only had the first 2 lines, so I added the [client] and [mysqld] parts.


    Then I shut down mysql and chkservd with the following commands:

    service mysql stop
    /etc/rc.d/init.d/chkservd stop


    Then I removed the following files:

    rm -rf /tmp/mysql.sock
    rm -rf /var/lib/mysql/mysql.sock


    Now restart mysql and chkservd with the following commands and mysql will create the mysql.sock file in the /tmp directory as oulined in the updated my.cnf file:

    service mysql start
    /etc/rc.d/init.d/chkservd start


    Now create the softlink with this:

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


    There were a couple of variations in that last last command to create the softlink. I guess it depends on where mysql creates the mysql.sock file when it starts. So if you are trouble shooting you might shut down mysql as shown above, then remove the mysql.sock files. Then restart mysql as shown above and see where it creates the mysql.sock file. If it creates it in the /tmp directory then you need the softlink command shown above. If it creates the mysql.sock file in the /var/lib/mysql directory then you problaby need to use the softlink command like this as shown in some of the other related posts:

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


    That worked for me. Hope this helps someone down the line.
     
    #3 nitromax, Jul 5, 2003
    Last edited: Jul 5, 2003
  4. Chuckman

    Chuckman Member

    Joined:
    Aug 1, 2002
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    It help me very much.

    Thank you for taking the time to post.

    Regards,


    Richard

    cPanel.net Support Ticket Number:
     
  5. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Thank you, I think cpanel needs you as a tech :D

    cPanel.net Support Ticket Number:
     
  6. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    I just started getting the same thing, so I tried what you suggested. When I try to start I get:
    " Starting mysqld daemon with databases from /var/lib/mysql
    030823 15:58:14 mysqld ended"

    When I view from processes from WHM, I get:
    /usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

    /tmp/mysql.sock isn't there because I deleted it, but mysql isn't recreating it. help???

    cPanel.net Support Ticket Number:
     
  7. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Also, when I try to service mysql stop, I get:
    "No mysqld pid file found. Looked for /var/lib/mysql/xxx.xxx.com.pid."

    How do I recreate the .pid file?

    cPanel.net Support Ticket Number: 21754
     
    #7 compunet2, Aug 23, 2003
    Last edited: Aug 23, 2003
  8. DWHS.net

    DWHS.net Well-Known Member
    PartnerNOC

    Joined:
    Jul 28, 2002
    Messages:
    1,569
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    LA, Costa RIca
    cPanel Access Level:
    Root Administrator
    Not sure, but I think you need to do this again:

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

    cPanel.net Support Ticket Number:
     
  9. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Same thing... I try to create the link, but it doens't show in the /tmp folder. After I do that I get:
    "Starting mysqld daemon with databases from /var/lib/mysql
    030823 17:48:34 mysqld ended"

    cPanel.net Support Ticket Number:
     
    #9 compunet2, Aug 23, 2003
    Last edited: Aug 23, 2003
  10. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    MySQL shutting down right after you attempt to start it up is a bad sign. Check the permissions/ownership on your mysql data directory.

    cPanel.net Support Ticket Number:
     
  11. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    I copied an old .pid file to the mysql directory, reset, and it all came back up again.

    cPanel.net Support Ticket Number:
     
  12. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    ok... same thing again today... replacing the backup .pid file and rebooting fixed it, but any idea why its deleteing the .pid file?

    cPanel.net Support Ticket Number:
     
  13. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    ok... the saga continues....
    The pid seems to be ok now... and mysql shows green from WHM, but when I try to use phpMyAdmin, I get
    "Wrong username/password. Access denied."

    here are some errors I get in apache_log:

    [Sun Aug 24 22:24:07 2003] g.cgi: DBI connect
    ('xxx_proscript:local

    [Sun Aug 24 22:24:07 2003] g.cgi: Can't conne
    ct to local MySQL server

    [Sun Aug 24 22:24:07 2003] [error] PHP Warnin
    g: mysql_select_db(): Ca

    [Sun Aug 24 22:24:07 2003] [error] PHP Warnin
    g: mysql_select_db(): A


    I tried stopping & restarting mysql, and no luck. I also checked for the link in the /tmp directory, and its still there....

    cPanel.net Support Ticket Number: 21754
     
Loading...

Share This Page