why isn't "which mysql" isn't showing the rest of the path defined in .bash_profile?

StackOverflow https://stackoverflow.com/questions/16888384

  •  30-05-2022
  •  | 
  •  

Question

This is listed in my .bash_profile

PATH="/usr/local/mysql/bin:/Applications/MAMP/Library/bin:$PATH"
export PATH

After applying those changes with ". .bash_profile", "which mysql" only outputs

/usr/local/mysql/bin

How do i get mysql to also look at /Applications/MAMP/... ?

Thanks in advance.

Était-ce utile?

La solution

What is happening here is that mysql/bin is listed before the MAMP bin folder. The path is being evaluated from left to right, meaning that because which found mysql in the mysql/bin folder it is returning that one, without ever processing the other directories.

If you want the mysql binary to be found from the MAMP binary folder, then switch the order of your PATH to PATH="/Applications/MAMP/Library/bin:/usr/local/mysql/bin:$PATH"

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top