I am trying to access MySql on my Ubuntu 10.04 LTS (lucid) system. I am aware that there are a lot of results out there for this error but none seem to be helping me. I am a novice on Linux so any help might need to be spelt out.
When running
mysql -u root -p
at the command prompt, I receive the error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
The sock file definitely exists; running
sudo ls -la /var/lib/mysql
includes the line
-rwxrwxr-- 1 mysql mysql 0 2011-11-03 19.05 mysql.sock
and running ls on the parent directory looks like this
sudo ls -la /var/lib
drwxr-xr-- 5 mysql mysql 4096 2011-11-03 18.14 mysql
I think MySql is running;
sudo service mysql start
results in
mysql start/running
And the my.cnf file (located at /etc/mysql/) includes the line
socket = /var/lib/mysql/mysql.sock
under the [mysqld] section.
Any pointers would be greatly appreciated. This site is live and since it is hosting a WordPress installation, not being able to access MySql completely breaks the site!
EDIT
Output from comment;
ps -ef | grep mysql
mysql 1869 1 0 20:15 ? 00:00:00 /usr/sbin/mysqld
pete 1953 1713 0 20:36 pts/0 00:00:00 grep --color=auto mysql
Best Answer
mysql.sock is NOT a socket file, it is a standard file with 0 byte size.
I'd (1) terminate mysql, (2) delete the mysql.sock file, and then (3)restart mysql which will properly make the socket file. You should see a socket file looking like the following when doing an ls -l mysql.sock.