StayFoolish StayFoolish - 25 days ago 11
MySQL Question

In .bash_profile already set the path but still got '-bash: mysql: command not found'

I'm quite frustrated that I got the error message trying to use

ipython
or
mysql
from the terminal in OSX. It used to work just fine, but now I got the error message.
Even if I navigated to where mysql is installed, I still get the error message:

Bruces-MacBook-Pro:bin bruce$ pwd
/usr/local/mysql/bin
Bruces-MacBook-Pro:bin bruce$ ls
innochecksum mysqlbinlog
lz4_decompress mysqlcheck
my_print_defaults mysqld
myisam_ftdump mysqld-debug
myisamchk mysqld_multi
myisamlog mysqld_safe
myisampack mysqldump
mysql mysqldumpslow
mysql_client_test_embedded mysqlimport
mysql_config mysqlpump
mysql_config_editor mysqlshow
mysql_embedded mysqlslap
mysql_install_db mysqltest_embedded
mysql_plugin mysqlxtest
mysql_secure_installation perror
mysql_ssl_rsa_setup replace
mysql_tzinfo_to_sql resolve_stack_dump
mysql_upgrade resolveip
mysqladmin zlib_decompress
Bruces-MacBook-Pro:bin bruce$ mysql
-bash: mysql: command not found


I did some search, and noticed that I should add the path to the
$PATH
variable in the
.bash_profile
, now I just use
less .bash_profile
to check if this is on my path, below is what I got:

export PATH="/usr/local/mysql/bin:$PATH"

export PATH="/Users/bruce/anaconda2/bin:$PATH"

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH"

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PATH"

export PATH="/Library/Python/2.7/site-packages"

export PATH="/opt/local/bin:/opt/local/sbin:$PATH"

export PATH="/Users/bruce/anaconda/bin:$PATH"

export PATH="/usr/local/bin:$PATH"

export PATH="/usr/bin:$PATH"

export PATH="/bin:$PATH"

export PATH="/usr/sbin:$PATH"

export PATH="/sbin:$PATH"

export PATH="/opt/X11/bin:$PATH"

.bash_profile (END)


(NOTICE: I have several
.bash_profilexxxx
files here under the home folder. Do I need to modify some of them? Like

.bash_profile
.bash_profile-anaconda.bak
.bash_profile-anaconda2.bak
.bash_profile.macports-saved_2015-12-29_at_23:07:52
.bash_profile.pysave


)

And it seems that I can't find
.bash_profile.pysave
directly under the home folder, but only available use
ls -a
command? If I need to modify this file, how?

Answer

I just found out why this is happening. I have two disks in my laptop. And many of the files are backed up in the older disk that have the same name. So the .bash_profile which I edited is actually on the older disk, which is not under my home folder.

Comments