PDA

View Full Version : [ubuntu] unable to connect to mysql



proggrammer
March 15th, 2013, 04:54 PM
Hi,

I am sorry for posting a popular question, but no available solution could help me.

mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I did:
me@System / $ ps -e|grep mysqld
5354 pts/0 00:00:00 mysqld_safe
5713 pts/0 00:00:07 mysqld

I even can see that phpmyadmin is working.
Kindly suggest me some solution.

matt_symes
March 16th, 2013, 02:07 AM
Hi

Is the socket actually there ? Please post the output of...


ls -l /var/run/mysqld/mysqld.sock

It may be an idea to post the config file as well.


cat /etc/mysql/my.cnf

Kind regards

steeldriver
March 16th, 2013, 02:17 AM
fyi that's exactly the error I get when the mysql server isn't running:


$ sudo service mysql stop
mysql stop/waiting
$
$ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)