When I tried to log into MySQL server with below command
$ mysql -u root -p
I got below error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
If you ever bumped into this error message while trying to connect to a local MySQL Server. Mostly It means either the MySQL server is not installed/running.
To check the status of MySQL service $ service mysqld status
If the MySQL service is inactive (dead), restart the service using below command
$ sudo service mysqld restart
For me MySQL showed this warning along with the fix command, so I fired the given command which took me next command prompt without any output and when I again checked the status of MySQL service It was running all fine
$ sudo systemctl daemon-reload
Now that the MySQL server is started, You will be able to login to MySQL server.