在 .bash_profile 中已经设置了路径但仍然得到 '-bash: mysql: command not found'

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

我在 OSX 的终端尝试使用 ipythonmysql 时收到错误消息,这让我感到非常沮丧。它曾经工作得很好,但现在我收到了错误消息。 即使我导航到 mysql 的安装位置,我仍然收到错误消息:

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

我做了一些搜索,发现我应该将路径添加到 .bash_profile 中的 $PATH 变量,现在我只使用 less .bash_profile 来检查它是否在我的路径,下面是我得到的:

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)

(注意:我的主文件夹下有几个 .bash_profilexxxx 文件。我需要修改其中的一些吗?比如

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

)

而且在home文件夹下好像找不到.bash_profile.pysave,只能用ls -a命令?如果我需要修改这个文件,怎么办?

我刚刚知道为什么会这样。我的笔记本电脑中有两个磁盘。许多文件都备份在同名的旧磁盘中。所以我编辑的 .bash_profile 实际上是在旧磁盘上,它不在我的主文件夹下。