Skip to content
Fix Code Error

Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

March 13, 2021 by Code Error
Posted By: Anonymous

I am getting the following error when I try to connect to mysql:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Is there a solution for this error? What might be the reason behind it?

Solution

Are you connecting to “localhost” or “127.0.0.1” ? I noticed that when you connect to “localhost” the socket connector is used, but when you connect to “127.0.0.1” the TCP/IP connector is used. You could try using “127.0.0.1” if the socket connector is not enabled/working.

Answered By: Anonymous

Related Articles

  • error LNK2005: ✘✘✘ already defined in…
  • Error 'Map', but got one of type 'Null' flutter web with…
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • Problems Installing CRA & NextJS from NPM (Error:…
  • XAMPP Port 80 in use by "Unable to open process" with PID 4
  • Rails wrong number of arguments error when generating…
  • Windows could not start the Apache2 on Local Computer -…
  • Error using core-scaffold from polymer JS in the latest…
  • Use SQL Server Management Studio to connect remotely to an…
  • error: 'Can't connect to local MySQL server through socket…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Launch Bootstrap Modal on page load

Next Post:

How to extract the substring between two markers?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Get code errors & solutions at akashmittal.com
© 2022 Fix Code Error