[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 : )

Leave a Reply

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