Connection failed: SQLSTATE[HY000] [2002] No such file or directory

This is my Username : epiz_28297370
error message : Connection failed: SQLSTATE[HY000] [2002] No such file or directory

Good afternoon

I am using all the correct credentials to connect to the database that I created but it does not work, is this a matter of privileges that would not work with a free account?

I look forward to hearing from you.

Hello there,

Please read this KB article first if you haven’t already:


Hi UnknownLolz

Thanks for your link, I went through everything and unfortunately I don’t seem to be able to find the problem, I am using all the right details for the database connection.

Hopefully I will be able to find some help online.

Thanks anyway

If you get a database error “No such file or directory” it means you are connecting with the database hostname localhost. This is not correct, it should be something like (check the MySQL Databases in the control panel for the actual value).

This is 100% guaranteed the one and only case that can cause this error.


Good evening Admin

I have looked at this error online, however I am not using localhost as a hostname, in fact I am using:
$host = “”; which is the host provided from the control panel area, I am not sure why I am getting this error.

If you have set the database hostname in a configuration file, but you still get this error, that’s usually caused by either an error in the configuration value or a bug in the script (where it doesn’t actually use the database hostname for the connection parameters).

Again, this error is 100% guaranteed to be caused by using localhost. There is no other situation where this error can occur.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.