Reputation: 13
I am using WP CLI to download and install WordPress using MAMP. I run into this error however when trying wp config create
env: mysql: No such file or directory
Couldn't find anything that addressed this error on developer.wordpress and other searches. I could edit the file manually of course, but that would spoil all the fun. Ideas?
Upvotes: 0
Views: 1967
Reputation: 21
If you can't connect to your database there are a few possibilities. One of them is, that you're using MAMP, like in your and my case, but WP-CLI is not using the MAMP PHP binary. You can check that by running
wp --info
To specify the MAMP PHP binary you'll need to modify your PATH
enviroment variable. You have to add
PHP_VERSION=$(ls /Applications/MAMP/bin/php/ | sort -n | tail -1)
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
to your ~/.bash_profile
or ~/.zsh_profile
If you want to use a specific PHP Version (eg. 5.5.26) just use
export PATH=/Applications/MAMP/bin/php/php5.5.26/bin:$PATH
After saving the file run:
source ~/.bash_profile
and
wp --info
to check your changes.
For further reading check the WP-CLI Handbook for using a custom PHP binary
Upvotes: 2