0

The path to my bin folder with mysql:

usr/local/mysql/bin

Here is my zshrc bash config:

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/Users/leon/bin/subl"
export PATH="/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH"

When I type mysql I get the following

enter image description here


Commands run:

echo $PATH
/Users/leongaban/.nvm/versions/node/v5.8.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

which mysql
mysql not found

mysql --help
zsh: command not found: mysql

sudo find / -name mysql
Password:
/Applications/MySQLWorkbench.app/Contents/MacOS/mysql

ps -ef | grep mysql
   74    96     1   0 11:18AM ??         0:02.90 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --port=3307
  501 16302  9174   0  1:27PM ttys001    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529

2 Answers2

1

Here are a few commands that might help determine more about the problem:

echo $PATH

which mysql

mysql --help

find / -name mysql

ps -ef | grep mysql

If you still have no clue you might post the output to those commands here. Also to paraphrase Alex Trebek, please phrase your post in the form of a question. What are you expecting to see?

Community
  • 1
  • 1
heyhey2k
  • 66
  • 1
  • 5
  • ah thanks, will try those in a bit and update my title – Leon Gaban Mar 16 '16 at 17:14
  • Also helpful to do a 'long listing' of the directory using 'ls -la' – heyhey2k Mar 16 '16 at 17:16
  • Heya I updated my Question with the commands you posted and the results I got – Leon Gaban Mar 16 '16 at 18:28
  • Figured it out, there was another `PATH` variable overriding my config, lower in my .zshrc default settings – Leon Gaban Mar 16 '16 at 18:55
  • @Leon - looks like your first value for PATH is not getting appended properly to the PATH that is exported. You might try adding everything to the same PATH listing. Also, I don't see the point in exporting PATH twice, so you might try removing the first 'export' if you decide to stick with two lines. – heyhey2k Mar 16 '16 at 18:59
  • Oops, didn't refresh there. Glad you found the problem! – heyhey2k Mar 16 '16 at 19:00
  • Yeah I moved it all into 1 PATH `export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/Users/leon/bin/subl:/usr/local/bin/fab"` – Leon Gaban Mar 16 '16 at 19:00
0

My PATH was correct, however it was getting overridden by a PATH var lower in my .zshrc file

# User configuration
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
# export MANPATH="/usr/local/man:$MANPATH"

After commenting out that line, mysql works again.

Leon Gaban
  • 36,509
  • 115
  • 332
  • 529