MySQL 我离开终端后没有保存 $PATH
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9127405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
$PATH not being saved after I leave terminal
提问by Daniel
I just installed mysql server 5.5.20 on my OS X Lion and everything works fine.Now,every time I go into terminal I have to explicitly write:
我刚刚在我的 OS X Lion 上安装了 mysql server 5.5.20,一切正常。现在,每次我进入终端时,我都必须明确地写:
PATH=${PATH}:/usr/local/mysql/bin
PATH=${PATH}:/usr/local/mysql/bin
because is not being saved after I leave the command line.I have no idea why such could be.
因为在我离开命令行后没有被保存。我不知道为什么会这样。
Ideas?
想法?
回答by Vyktor
You have to add
你必须添加
PATH=${PATH}:/usr/local/mysql/bin
export PATH
to your ~/.bash_profile
or .bashrc
(or use similar option when using different shell).
到您的~/.bash_profile
或.bashrc
(或在使用不同外壳时使用类似选项)。
If you want it to be system wide, you should upgrade: /etc/bash.bashrc
(on archilnux, can wary on your distribution)
如果你希望它是系统范围的,你应该升级:(/etc/bash.bashrc
在 archilnux 上,可以警惕你的发行版)
回答by Sergey Benner
edit your ~/.bash_profile and put the line export PATH=$PATH:/usr/local/mysql/bin
编辑您的 ~/.bash_profile 并将行 export PATH=$PATH:/usr/local/mysql/bin
回答by Renat Gatin
Then do not forget to run following command for bash to implement the current path without restarting:
然后不要忘记为bash运行以下命令以实现当前路径而无需重新启动:
source ~/.bash_profile
At the end you can try this command to check if path correctly implemented:
最后,您可以尝试使用此命令来检查路径是否正确实现:
echo $PATH
it will show the content of your PATH, ideally you should find your new path there.
它将显示您的 PATH 的内容,理想情况下您应该在那里找到您的新路径。
回答by user2912087
I solved on my macOS High Sierra.
我在我的 macOS High Sierra 上解决了。
- Open finder and go to path /Users/YOUR_USERNAME
- Show hidden files with Shift + cmd + .
- Create (if not exists) a file .profile
- Write in this file export PATH=/YOUR PATH
- Save this file. (If you have problem, try to create the file with sudo command)
- 打开查找器并转到路径 /Users/YOUR_USERNAME
- 使用 Shift + cmd + 显示隐藏文件。
- 创建(如果不存在)一个文件 .profile
- 在此文件中写入 export PATH=/YOUR PATH
- 保存此文件。(如果有问题,请尝试使用 sudo 命令创建文件)
回答by Mohammad Heydari
use export PATH=/home/username/anaconda3/bin:$PATH
in terminal
and then type anaconda-navigator.
the app will be start instantly
export PATH=/home/username/anaconda3/bin:$PATH
在终端中使用然后输入anaconda-navigator.
应用程序将立即启动