MySQL stopped working - Error 2002 - Unknown Instance

MySQL server was installed and was running just fine. Today we can't connect to the database via our websites. Command line access using mysql -u username -p also fails. Finally, phpmyadmin fails.

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

service mysql restart
stop: Unknown instance:
start: Job failed to start

Error logs (/var/log/mysql/error.log & /var/log/mysql.err & /var/log/mysql.log) are all empty for the past week. The problem just began today.

I have looked at lots of answers including Ubuntu Error 2002 “Can't connect to local MySql server through socket…” and ERROR 2002 (HY000): Can't connect to local MySQL.

Should I just reinstall mysql server and chalk it up as an unknown error? (horrible idea, obviously).

What is the right course of action to fix immediately and prevent from reoccurring?


I changed the bind-address from the IP to 127.0.0.1. Still not sure why this worked and then all of a sudden stopped. Here is the solution for others.

sudo nano /etc/mysql/my.cnf

change

bind-address = "127.0.0.1"

And then

sudo service mysql restart