I just installed wp-cli using homebrew and changed the PHP path in .bash_profile to below.

export WP_CLI_PHP=/Applications/MAMP/bin/php/php5.6.10/bin/php
export PATH=$PATH:/Applications/MAMP/Library/bin

When I run this command,

wp core config --dbname="testwp" --dbuser="root" --dbpass="root"

I get this error:

sh: mysql: command not found

Also the output of running wp --info is:

PHP version:    5.6.10
php.ini used:   /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
WP-CLI root dir:    /usr/local/Cellar/wp-cli/0.21.1
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.21.1

I'm not sure if I have framed my question well, so would appreciate all the help.


It looks like you probably don't have mysql in your path. From the command prompt, you should be able to run 'mysql' and enter the mysql interactive environment. If you see something like 'command not found.' then keep working on that path.

There are few different ways to set up your path, I prefer to update the system PATH environment variable so that it become a one-time-thing. (google it - it is a pain on both Windows or Mac).

This post (https://stackoverflow.com/questions/17664021/mysql-command-not-found-mamp) suggests your proper path is something like this.. PATH=$PATH:/Applications/MAMP/Library/bin

Good luck

  • Hey @JJ-Rohrer, I tried that by adding the additional line but no luck yet. Also by running "mqsql" I do see the interactive env, but I'm assuming it's the mysql installed by default on Mac. I'm still looking, so If I find a solution I'll post it here. Thanks again. – Harish Chouhan Dec 2 '15 at 16:00
  • 1
    Hey there, I think your answer was probably right. I just had to restart the terminal and then it worked. – Harish Chouhan Dec 2 '15 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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