0

I'm running WP CLI and MAMP on my MacBook for a local development environment. My version of WP CLI is current (0.24.1). I've just upgraded MAMP to it's latest version (4.0.4), which also upgrades to MySQL 5.6. After running the upgrade, I began receiving a fatal error when calling any WP CLI command that involves a database connection.

For example, a command involving only the file system ("wp core verify-checksums", for example) produces expected results. However, "wp plugin list", for example, results in the following errors:

Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Applications/MAMP/htdocs/wp-includes/wp-db.php on line 1490

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /Applications/MAMP/htdocs/wp-includes/wp-db.php on line 1520

Warning: mysql_connect(): No such file or directory in /Applications/MAMP/htdocs/wp-includes/wp-db.php on line 1520

Fatal error: Call to undefined function wp_die() in /Applications/MAMP/htdocs/wp-includes/wp-db.php on line 3103

I don't find any known compatibility issues with the WP CLI latest and MySQL 5.6 when I search, but perhaps I'm missing something. I'm more inclined to think that this is a local environment issue. Site functions without issue after the upgrade, and I'm still able to administrate databases within MAMP via Sequel Pro.

Any ideas?

2 Answers 2

3

Resolved the issue. The problem was that the default PHP version changed with the new version of MAMP, and I had set the path in .bash_profile to the explicit version of the previous MAMP install. Once I edited the .bash_profile to dynamically find the version of PHP in use, everything works perfectly.

1

The compatibility problem can be a result of your php version, php settings or/and wordpress version. the "old" mysql php library was deprecated at 5.5 (IIRC) and replace with the mysqli library. Wordpress core was changed at the time to support mysqli on the appropriate php version.

What you need to do is to make sure you are running a relatively current version of wordpress, and you have the mysqli library enable in your php settings

2
  • Thanks for the answer. Running PHP 5.6.25 (not 7, but still "current"). PHP info shows mysqli enabled, and WordPress is the latest version, so it doesn't look like this is the issue.
    – DavidBrown
    Sep 25, 2016 at 20:27
  • hmmm, that is exactly what the error says Sep 25, 2016 at 20:29

Your Answer

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

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