Adding Homebrew MySQL Service to your PATH

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:

/usr/local/Cellar/mysql@5.7/5.7.25/ 

To add this to your PATH, add this to your .bash_profile (or .zhsrc if you use ZSH):

export PATH=/usr/local/Cellar/mysql@5.7/5.7.25/bin:$PATH 

Then, reload your shell and type mysql -u root to confirm all is working.

You can quit the mysql CLI via mysql> q



Comments

2 responses to “Adding Homebrew MySQL Service to your PATH”

  1. This Article was mentioned on cagrimmett.com

  2. acidcode Avatar
    acidcode

    my terminal is ZSH.

    Your post have a issue on .zshrc file name.

Leave a Reply

Webmentions

If you've written a response on your own site, you can enter that post's URL to reply with a Webmention.

The only requirement for your mention to be recognized is a link to this post in your post's content. You can update or delete your post and then re-submit the URL in the form to update or remove your response from this page.

Learn more about Webmentions.