conny
conny

Reputation: 119

zsh: command not found: mysql. MySQL is not compatible for zsh?

Isn't possible to install MySQL in zsh in macOS?

I have been trying to install MySQL on my Mac.

zsh: command not found: mysql

Should I give up setting MySQL on zsh and try to do in bash?


% brew install [email protected]
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/manifests/5.7.32-2
Already downloaded: /Users/stackover/Library/Caches/Homebrew/downloads/abe6a0a4787f4c4bd9c6d14e27d98d868c1f0f619cbbba601e8225--mysql@5.7-5.7.32-2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/blobs/sha256:82867504
Already downloaded: /Users/stackover/Library/Caches/Homebrew/downloads/8db250bb2773af3411c71cf86232ed647cdf9366670c716c52574d--mysql@5.7--5.7.32.arm64_big_sur.bottle.2.tar.gz
==> Pouring [email protected]_big_sur.bottle.2.tar.gz
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

[email protected] is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"


To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/[email protected]/bin/mysql.server start
==> Summary
🍺  /opt/homebrew/Cellar/[email protected]/5.7.32: 319 files, 233.7MB
stackover@stackoverjunoMacBook-Air ~ %   echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
stackover@stackoverjunoMacBook-Air ~ % myql --version
zsh: command not found: myql
stackover@stackoverjunoMacBook-Air ~ % mysql --version
zsh: command not found: mysql
stackover@stackoverjunoMacBook-Air ~ %   export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
stackover@stackoverjunoMacBook-Air ~ %   export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
 echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"

I checked if it installed:

stackover@stackoverjunoMacBook-Air ~ % mysql --version     

but

zsh: command not found: mysql

I also tried this:

stackover@stackoverjunoMacBook-Air ~ % mysql -uroot
zsh: command not found: mysql 

Upvotes: 4

Views: 4638

Answers (1)

Marlon Richert
Marlon Richert

Reputation: 6985

stackover@stackoverjunoMacBook-Air ~ %   echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
stackover@stackoverjunoMacBook-Air ~ % mysql --version
zsh: command not found: mysql

Your shell does not automagically pick up new executables from your $path. For the shell to find the new executable, you will need to

  • rebuild your shell’s command lookup table with
    hash -fr
    
  • restart your shell with
    exec zsh
    
  • or open a new tab in your terminal.

Upvotes: 1

Related Questions