If you install mysql via Homebrew (
$ brew install mysql) and start it via Homebrew services (
$ brew services start mysql), chances are that you’ll see an error when trying run
mysql -u root on the command line.
If that error is
command not found: mysql, the issue is likely that you need to add the Homebrew mysql directory to your PATH.
On my machine, Homebrew installed mysql here:
To add this to your PATH, add this to your
.zhsrc if you use ZSH):
Then, reload your shell and type
mysql -u root to confirm all is working.
You can quit the mysql CLI via