I tried the following steps:
- Log in as
super user or use sudo
- Open
/etc/mysql/my.cnf using gedit
- Check the all the configuration
- Find
bind-address, and change its value to the database server host machine’s IP address. For me, it was localhost or 127.0.0.1
- Save and close the file.
- Come back to terminal and execute
sudo service mysql start
And it worked for me.