Results 1 to 1 of 1

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

  1. #1
    Member
    Join Date
    Jan 2004
    Location
    North Carolina
    Posts
    7

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

    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.

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

    Code:
    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 hostname.domain.com.err 
     -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/hostname.domain.com.pid 
     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 
     eekland.domain.com.pid --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
    Last edited by Outofmymindyo; 06-27-2004 at 02:56 AM.

Similar Threads

  1. Replies: 13
    Last Post: 06-15-2010, 04:31 PM
  2. Replies: 13
    Last Post: 06-15-2010, 04:31 PM
  3. Replies: 2
    Last Post: 06-22-2009, 08:30 AM
  4. Replies: 1
    Last Post: 04-21-2007, 01:23 AM
  5. Can't connect to local MySQL server through socket '/tmp/mysql.sock'
    By gopederick in forum cPanel & WHM Discussions
    Replies: 5
    Last Post: 09-17-2004, 02:06 PM