I was having a problem accessing mysql from terminal and get this error.
After spending about 30 mins, I found out that the error comes from configuration of MySQL and there is no socket file on the default file location.
To solve this,follow these steps.
Now,run mysql command again and it should be working. If the problem is still continuing, please check that the server is running and also make sure about the port and bind-address. Log files(/var/log/mysql/mysql.log & /var/log/mysql/error.log) can give you clues too.
Happy Querying…