Wp-cli: wp-db.php no file found

Created on 16 Apr 2016  路  4Comments  路  Source: wp-cli/wp-cli

Hi everyone, I have just updated to Wordpress 4.5 and I am using iTerm Build 2.9.20160313 with CP-CLI. I am having issues finding a database connection.

I understand there was an issue initially with WP 4.5 and the way they were changing how wp-cli worked but this is a new error message. Here is what I am getting when trying to do a normal wp core update:

Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/usr/Business/Development/site/core/wp-includes/wp-db.php on line 1489
Warning: mysql_connect(): No such file or directory in /Users/usr/Business/Development/site/core/wp-includes/wp-db.php on line 1515
Error: Error establishing a database connection

Is there anything I can do to get this working?

I am using Mamp Pro using PHP7 if this helps.

Thank you in advance

unconfirmed

Most helpful comment

if you use MAMP , you should set the latest PHP version provided by MAMP and do not use the default PHP binary.
see : https://make.wordpress.org/cli/handbook/installing/#using-a-custom-php-binary

All 4 comments

Can you share the contents of your wp-config.php file, minus any secrets?

And, just to confirm, you've configured WP-CLI to use the appropriate PHP binary?

Thank you Daniel, adding the extra line to the bash profile seemed to do the trick! Not 100% sure why it stopped working all of a sudden.

@dsgnr What extra line did you add? I'm having the same issue.

if you use MAMP , you should set the latest PHP version provided by MAMP and do not use the default PHP binary.
see : https://make.wordpress.org/cli/handbook/installing/#using-a-custom-php-binary

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JOduMonT picture JOduMonT  路  3Comments

mirzazeyrek picture mirzazeyrek  路  3Comments

jacklenox picture jacklenox  路  3Comments

killown picture killown  路  3Comments

ernilambar picture ernilambar  路  3Comments