So this was my first time putting up a LAMP stack on a Bodhi machine (previously experience with WAMP, and LAMP on 10.04); I got Apache going, and a Drupal install begun, then I go to create a new database and when I log in to phpmyadmin ... I get a 'cannot connect error'. Tracing this back, the issue began once I tried to get virtual hosts up and running in Apache; once that was done I started running into socket connection issues with mysql.

Initially the problem looked like this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Using ls -lart /var/run/my* I get this:

  total 0
  drwxr-xr-x  2 mysql root  40 Jan 31 11:56 .
  drwxr-xr-x 21 root  root 740 Jan 31 12:21 ..`

I ran touch /var/run/mysqld/mysqld.sock and set chown -R mysql /var/run/mysqld which allows for:

total 0
drwxr-xr-x 21 root  root 740 Jan 31 12:21 ..
-rw-r--r--  1 mysql root   0 Jan 31 13:58 mysqld.sock
drwxr-xr-x  2 mysql root  60 Jan 31 13:58 .
  • So when I try to run mysql -u root -p I get one error - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) (note it is no longer ERROR 2002...(2) but rather ERROR 2002...(13))
  • If I try service mysql restart (or stop, start) I get another error - start: Rejected send message, 1 matched rules; type="method_call", sender=":1.49" (uid=1000 pid=8407 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
  • When I run sudo service mysql restart I get stop: Unknown instance: start: Job failed to start
  • When I run service mysql status I get "mysql stop/waiting"

What can I do to diagnose the issues I am having with mysql? I may be overlooking an utterly simple mysql issue and would appreciate any feedback on what I've done so far.

Also, being a Bodhi machine and most of the instruction/feedback being written for Ubuntu, I am unsure to what extent any Ubuntu instruction may not apply. In particular, am I running into a problem related to the difference between /etc/init.d/... and service ... ... commands? Or, perhaps, am I running into a difference between libraries of the two?

  • Please post the content of the MySQL error log. Commented Feb 8, 2013 at 21:16

1 Answer 1


check in your nano /etc/mysql/my.cnf open the file . Search for bind-address in file if it is localhost or than you should be able to login but if it is something other than localhost than you have to give host to your mysql command mysql -uroot -h xxx.xxx.xxx.xxx -p

Not the answer you're looking for? Browse other questions tagged .