Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

ERROR 2002 (HY000): Can't connect to MySQL

ERROR 2002(HY000):Can't connect to local MySQL



This is error can come to you anytime but with a reason behind it. When you face this issue generally everyone goes to search engine and try to solve the issue and finally after some time its got solved.

Now while going through a upgrade or update from one level to another level this kind of things happens.

Solution that easily come up with this search -

  • Check that you have client or server of mysql version
  • If not server then install it by running the command on your linux [Ubuntu] Terminal
  sudo apt-get install mysql-server

If that's not the case try the following steps to figure out as I have also figured out same as


  • 1. Log in as a super user or use sudo
  • 2. Open the mysql's config file as /etc/mysql/my.cnf
  • 3. Find bind-address and then change the address to IP of the machine of Database for me it was localhost
  • 4. Save and close
  • 5. Restart the mysql by going to terminal and run command

  sudo service mysql restart


If everything is same as above written then just go to terminal and restart the mysql and it will work fine.

If anything just comment below to get out of your situation which is irritating you.

Top #3 Articles