0

for no reason in getting this error on

There has been an error processing your request SQLSTATE[HY000] [2002] No such file or directory

enter image description here

3
  • On which page above error show to you? Commented Feb 5, 2020 at 14:02
  • main home page and every page im getting this error Commented Feb 5, 2020 at 14:02
  • Is There any solution for this Commented Feb 5, 2020 at 14:09

2 Answers 2

1

You need try to change the database hostname from localhost to 127.0.0.1 into the following file.

app\etc\local.xml

1
  • 1
    Have you check your host entry into the given file? Commented Feb 5, 2020 at 14:27
0

This is showing that your MySQL client can't connect to the MySQL server.

I'm going to assume you're using localhost as the host in your app/etc/local.xml config so it'll be attempting to look for the MySQL socket at (usually) /var/run/mysqld/mysqld.sock on the server. If it can't find it, then it throws this error. Check that MySQL is running and that this file (or another similar) exists.

If it is running but it just isn't connecting still, then try changing localhost to 127.0.0.1 to have the client attempt to connect via TCP instead of a via the .sock file.

If you're running on an environment where the MySQL server isn't located either via the .sock file or at IP address 127.0.0.1, then use the correct IP address/Hostname instead. For example, some hosts may put the DB on a hostname like db1.myhost.com so your host entry in your config would look as <host>db1.myhost.com</host>

2
  • No i am not running this site on local buddy it is up on server Commented Feb 5, 2020 at 14:23
  • I understand that, when I say localhost I mean the value in your app/etc/local.xml file, and by your system I mean the server that the site is on. Commented Feb 5, 2020 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.