Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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

Discussion in 'General Discussion' started by Outofmymindyo, Jun 27, 2004.

  1. Outofmymindyo

    Outofmymindyo Member

    Jan 12, 2004
    Likes Received:
    Trophy Points:
    North Carolina
    Just wanted to post this possible fix for people that are getting the following error when trying to start/restart MySQL, as this procedure worked perfectly for me.

    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    This is the procedure I followed:

    Techy: Login as root to WHM and look at the service status
    Techy: See what all is red
    Me: just eximstats and MySQL right now
    Techy: Look in /var/lib/mysql
    Me: there's more than one .err file
    Techy: ls -l|grep err
    Me: -rw-rw----    1 nobody   root         1227 May  5 09:21 C0001-planetXeonimaging.err 
     -rw-rw----    1 nobody   root         1227 Jun 20 13:53 C0001-planetXeonRH9CP.err 
     -rw-rw----    1 nobody   root         3915 Jun 26 02:24 domain.err 
     -rw-rw----    1 mysql    root        13080 Jun 26 07:56 
     -rw-rw----    1 nobody   root         4068 Apr 29 18:29 localhost.localdomain.err
    Techy: Look in hostname.domain.err
    Techy: Show me the last lines of that file
    Me: 040626 08:05:27  mysqld started 
     040626  8:05:27  Can't start server : Bind on unix socket: Permission denied 
     040626  8:05:27  Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ? 
     040626  8:05:27  Aborting 
     040626  8:05:27  /usr/sbin/mysqld: Shutdown Complete 
     040626 08:05:27  mysqld ended
    Techy: ps aux|grep mysql
    Me: root     14658  0.0  0.0  3580  632 pts/2    S    08:06   0:00 grep mysql
    Techy: rm /var/lib/mysql/mysql.sock
    Techy: service mysql start
    Me: rm: cannot lstat `/var/lib/mysql/mysql.sock': No such file or directory
    Techy: cd /var/lib
    Techy: ls -l|grep mysql
    Me: drwxr-x--x   88 nobody   root         4096 Jun 26 08:05 mysql/
    Me: is that supposed to be that way?
    Techy: Checking
    Me: k
    Techy: chown mysql:root mysql mysql
    Techy: errr
    Techy: chown mysql:root mysql
    Techy: service mysql start
    Me: shall i run that chown command in the top directory?
    Me: or just the var/lib?
    Techy: In /var/lib
    Me: ok, ran service mysql start
    Me: no confirmation or errors
    Techy: ps aux|grep mysql
    Me: WHM doesn't show it as running
    Me: root     14696  0.0  0.1  4196 1180 pts/2    S    08:11   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/ 
     mysql    14716  0.2  1.1 31208 11604 pts/2   S    08:11   0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/g --skip-locking 
     root     14744  0.0  0.0  3576  632 pts/2    S    08:12   0:00 grep mysql
    Techy: chskervd will pick it up in a few minutes
    #1 Outofmymindyo, Jun 27, 2004
    Last edited: Jun 27, 2004

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice