So, I am running mysql on an ubuntu server (command-line) VirtualBox, on a Windows 7 host. In the Virtual machine, I changed the /etc/mysql/my.cnf file by commenting out the line

bind-address =

so it looks like

#bind-address =

I then restarted the server like so:

perrin@LinuxServer1:~$ sudo /etc/init.d/mysql restart
[sudo] password for perrin:
 * Stopping MySQL database server mysqld    [ OK ]
 * Starting MySQL database server mysqld    [ OK ]

After this, I started getting this error whenever I try to connect to mysql, like so:

perrin@LinuxServer1:~$ mysql -u root -p
Enter password:
Error 2002 (HY000): Can't connect to local MySQL server through socket '/var/
run/mysqld/mysqld.sock' (2)

I searched for help and found out that my MySQL server was NOT running, even though it had SAID [ OK ] when starting back up. (lying P.O.S.)

So I try to start it, using both start and restart like so:

perrin@LinuxServer1:~$ sudo /etc/init.d/mysql start
 * Starting MySQL database server mysqld    [fail]
perrin@LinuxServer1:~$ sudo /etc/init.d/mysql restart
 * Stopping MySQL database server mysqld    [ OK ]
 * Starting MySQL database server mysqld    [fail]

So I go back to the my.cnf and un-comment the bind-address = line, so that everything is EXACTLY as it was before, and try again to start/restart the server. It fails again in exactly the same way.

I've searched all over the web for help and found a few SIMILAR problems people were having, but nothing ultimately useful, or that gave me any tips that led to a solution.

Does anyone have any idea what is going on here? I'm stumped.

up vote 1 down vote accepted

In the list of related questions here on AskUbuntu, I noticed one titled "12.04 - MySql won't start by using service mysql start".

Reading this alerted me to the fact that MySQL can be stopped/started/restarted with:

perrin@LinuxServer1:~$ sudo service mysql stop


perrin@LinuxServer1:~$ sudo service mysql start


perrin@LinuxServer1:~$ sudo service mysql restart

These methods worked for me, even after commenting out the bind-address line in my.cnf, and I can now log into mysql again after starting/restarting it up.

It just bugs me that I don't know why the init.d method doesn't work. :(

  • You are a genius. This EXACT same thing happened to me and I just spent 3 hours troubleshooting. Cheers to you! – Allen Gingrich Aug 30 '14 at 17:58

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.