bash 将 mysql 添加到我的 .bashrc PATH

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2314002/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 21:42:48  来源:igfitidea点击:

Adding mysql to my .bashrc PATH

macosbashpath

提问by Daniel

Ok, maybe I'm doing something really stupid.

好吧,也许我在做一些非常愚蠢的事情。

I'm on OSX 10.6.1.

我在 OSX 10.6.1 上。

I want to add mysql to my path, so I add the following to my .bashrc

我想将 mysql 添加到我的路径中,所以我将以下内容添加到我的 .bashrc

PATH = ${PATH}:/usr/local/mysql/bin
export PATH

upon running terminal, it doesn't work, which I expect, because .bash_profile is not loading .bashrc at the moment.

在运行终端时,它不起作用,这是我所期望的,因为 .bash_profile 目前没有加载 .bashrc。

but if I manually enter bash, i get the following error

但是如果我手动输入 bash,我会收到以下错误

bash: PATH: command not found

What am I doing wrong?

我究竟做错了什么?

回答by ennuikiller

you can't have any spaces. In other words, your PATH setting command should be:

你不能有任何空格。换句话说,你的 PATH 设置命令应该是:

PATH=${PATH}:/usr/local/mysql/bin

Note the removal of the spaces between PATH, =, and ${PATH}

请注意删除 PATH、= 和 ${PATH} 之间的空格