# Adding Homebrew MySQL Service to your PATH

- Link: https://cagrimmett.com/2019/06/11/use-homestead-mysql-command-line/
- Published: 2019-06-11T13:00:00-04:00
- Author: Chuck Grimmett

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:

    ```highlight
    /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):

    ```highlight
    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

### By: Why blog?

- Link: https://cagrimmett.com/thoughts/2022/04/26/why-blog/
- Published: 2022-05-09T15:13:21-04:00

This Article was mentioned on [cagrimmett.com](https://cagrimmett.com/thoughts/2022/04/26/why-blog/)

Loading...

### By: acidcode

- Link: https://cagrimmett.com/2019/06/11/use-homestead-mysql-command-line/#comment-30024
- Published: 2023-07-05T07:37:18-04:00

my terminal is ZSH.

Your post have a issue on .zshrc file name.

Loading...
