[SOLVED] ERROR mysqli_real_connect(): (HY000/2002): No such file or directory

If you are getting a wordpress error that starts with “mysqli_real_connect(): (HY000/2002):” and includes “No such file or directory” and ends with “wp-includes/wp-db.php on line 1490”, then here is what resolved the issue for me.

In the wp-config.php file, include (or change) this line from

define(‘DB_HOST’, ‘localhost’);

to

define(‘DB_HOST’, ‘127.0.0.1’);

I put it near the top. Hopefully this will help someone.

leave a comment : )

2 thoughts on “[SOLVED] ERROR mysqli_real_connect(): (HY000/2002): No such file or directory


  1. Hi Sir, I also face the same problem. And I fix this solution. But, I get this error. Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘aiconcs_user’@’127.0.0.1’ (using password: YES) in /var/www/html/aiconcs/wp-includes/wp-db.php on line 1753

Leave a Reply

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