1

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 = 127.0.0.1

so it looks like

#bind-address = 127.0.0.1

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 = 127.0.0.1 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.

1 Answer 1

1

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

or

perrin@LinuxServer1:~$ sudo service mysql start

or

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. :(

1
  • You are a genius. This EXACT same thing happened to me and I just spent 3 hours troubleshooting. Cheers to you! Aug 30, 2014 at 17:58

You must log in to answer this question.

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