If you get an error like below when trying to connect to your MySQL server from the terminal, you can solve the issue by following the steps below.
$ mysql -u root
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
#mysql #mysql server