0

When I try to connect the MySQL database that is on my Mac to a website, I get the following error:

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

That is when I put localhost as the servername.

When I put 127.0.0.1 as the servername, I receive the following error:

Can't connect to MySQL server on '127.0.0.1' (13)

The following Stack questions did not work for me: Cannot connect to mysql with 127.0.0.1 error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'

Community
  • 1
  • 1
PHP Web Dev 101
  • 535
  • 2
  • 9
  • 21

1 Answers1

0

First, you should check the status of mysql server: is that runs? the difference between tow error is based on allowed mysql connection port over network.

Hossein
  • 1,301
  • 1
  • 12
  • 23