[ubuntu-za] Can't connect to local MySQL server

Alf Stockton alf at stockton.co.za
Wed Jan 28 10:48:06 GMT 2009


Louis van der Merwe wrote:
> 2009/1/28 Alf Stockton <alf at stockton.co.za>:
>> I get :-
>> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
>> '/var/lib/mysql/mysql.sock' (111)
>> when I attempt to mysql -u root -p
>>
>> even though the user and password is correct and
>> root at general:~# ls -al /tmp/mysql.sock
>> lrwxrwxrwx 1 root root 25 2009-01-28 10:18 /tmp/mysql.sock ->
>> /var/lib/mysql/mysql.sock
>> root at general:~# ls -al /var/lib/mysql/mysql.sock
>> -rw-r--r-- 1 root root 0 2009-01-28 11:40 /var/lib/mysql/mysql.sock
>>
>> please tell me what I need to fix.
>>
> 
> Hi Alf,
> It may be that the server died without deleting the .sock file.
> 
> do `ps -ef | grep -i mysqld` to varify that the server process is still running.
> 
> also check the mysql logs in /var/log/ which may indicate what the problem is.
> 
> regards
> 
> Louis
> 
Thanks Louis but:-
 > root at general:~# ps -ef | grep -i mysqld
root     18110     1  0 11:09 pts/3    00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql    18149 18110  0 11:09 pts/3    00:00:01 /usr/sbin/mysqld 
--basedir=/usr --datadir=/var/lib/mysql --user=mysql 
--pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 
--socket=/var/run/mysqld/mysqld.sock
root     18151 18110  0 11:09 pts/3    00:00:00 logger -p daemon.err -t 
mysqld_safe -i -t mysqld
root     23163 17431  0 12:40 pts/3    00:00:00 grep -i mysqld
root at general:~# ls -al /var/log/
apache2/            daemon.log.0        dmesg.4.gz          mail.info 
   mysql.log.1.gz      syslog.1.gz
apparmor/           daemon.log.1.gz     dpkg.log            mail.info.0 
   mysql.log.2.gz      syslog.2.gz
apt/                daemon.log.2.gz     dpkg.log.1          mail.log 
   mysql.log.3.gz      syslog.3.gz
aptitude            dbconfig-common/    faillog             mail.log.0 
   mysql.log.4.gz      syslog.4.gz
aptitude.1.gz       debug               fsck/               mail.warn 
   mysql.log.5.gz      syslog.5.gz
auth.log            debug.0             installer/          mail.warn.0 
   mysql.log.6.gz      syslog.6.gz
auth.log.0          debug.1.gz          kern.log            messages 
   mysql.log.7.gz      tomcat5.5/
auth.log.1.gz       dist-upgrade/       kern.log.0          messages.0 
   news/               udev
auth.log.2.gz       dmesg               kern.log.1.gz       messages.1.gz 
   postgresql/         user.log
boot                dmesg.0             lastlog             messages.2.gz 
   pycentral.log       user.log.0
btmp                dmesg.1.gz          lpr.log             mysql/ 
   request-tracker3.6/ wtmp
btmp.1              dmesg.2.gz          mail.err            mysql.err 
   syslog              wtmp.1
daemon.log          dmesg.3.gz          mail.err.0          mysql.log 
   syslog.0
root at general:~# ls -al /var/log/mysql.log
-rw-r--r-- 1 mysql adm 0 2009-01-28 06:48 /var/log/mysql.log
root at general:~# ls -al /var/log/mysq*
-rw-r----- 1 mysql adm    0 2009-01-19 14:09 /var/log/mysql.err
-rw-r--r-- 1 mysql adm    0 2009-01-28 06:48 /var/log/mysql.log
-rw-r----- 1 mysql adm   20 2009-01-27 06:53 /var/log/mysql.log.1.gz
-rw-r----- 1 mysql adm   20 2009-01-26 06:28 /var/log/mysql.log.2.gz
-rw-r----- 1 mysql adm   20 2009-01-25 06:40 /var/log/mysql.log.3.gz
-rw-r----- 1 mysql adm   20 2009-01-24 06:51 /var/log/mysql.log.4.gz
-rw-r----- 1 mysql adm   20 2009-01-23 06:40 /var/log/mysql.log.5.gz
-rw-r----- 1 mysql adm   20 2009-01-22 06:37 /var/log/mysql.log.6.gz
-rw-r----- 1 mysql adm   20 2009-01-21 06:42 /var/log/mysql.log.7.gz

-- 
Regards,
Alf Stockton		www.stockton.co.za

Caution: Keep out of reach of children.



More information about the ubuntu-za mailing list