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

Neil Muller neil at dip.sun.ac.za
Wed Jan 28 12:32:44 GMT 2009


On Wed, Jan 28, 2009 at 02:13:13PM +0200, Alf Stockton wrote:
> After stopping mysqld I removed the /var/lib/mysql/mysql.sock and restarted 
> mysqld but still cannot log on as follows:-
> root at general:~# ps aux | grep mysql
> root     25321  0.0  0.0   3944   604 pts/3    S    13:59   0:00 /bin/sh 
> /usr/bin/mysqld_safe
> mysql    25360  0.0  0.8  83296  9232 pts/3    Sl   13:59   0:00 
> /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

So the mysql server is listening for connections via
/var/run/mysqld/mysqld.sock

> root     25362  0.0  0.0   5068   812 pts/3    S    13:59   0:00 logger -p 
> daemon.err -t mysqld_safe -i -t mysqld
> root     25442  0.0  0.0   5164   832 pts/3    R+   14:03   0:00 grep mysql
> root at general:~# mysql -u root
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
> '/var/lib/mysql/mysql.sock' (2)

yet the client is still using /var/lib/mysql/mysql.sock - looks a bit
dubious, no?

I'd first try using the --socket option to mysql to try the one the
server's listening on, to see that things are indeed working, and then,
since that really should work, try and track down why your client's
using the wrong socket - you probably have socket speicified incorrectly
either in ~.my.cnf or /etc/mysql/my.cnf

-- 
Neil Muller  email: neil at dip.sun.ac.za 

Division Applied Mathematics, Department of Mathematical Sciences
University of Stellenbosch



More information about the ubuntu-za mailing list