macos Mac OS X 上 MySql 的快捷方式?

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

Shortcut to MySql on Mac OS X?

mysqlmacospath

提问by sscirrus

I am trying to add a path so I don't have to keep typing usr/local/mysql/binevery time I want to start Mysql. I found instructions herethat say:

我正在尝试添加一个路径,这样我就不必usr/local/mysql/bin每次要启动 Mysql 时都继续输入。我在这里找到了说明:

Edit the file /etc/profile and update the path by adding: usr/local/mysql/bin/, for example: PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin"

编辑文件 /etc/profile 并通过添加:usr/local/mysql/bin/来更新路径 ,例如: PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin"

Problems:
1. There is no existing line in my profile file that says 'path'. This is what it currently says in profile: # System-wide .profile for sh(1)

问题:
1. 我的配置文件中没有显示“路径”的现有行。这是它目前在配置文件中所说的: # System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval '/usr/libexec/path_helper -s'
fi
if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
fi

2. I really have no idea what I'm doing on a mac (yet). What do I add/change to the above file so mysql is easier to access?

2. 我真的不知道我在 mac 上做什么(现在)。我在上面的文件中添加/更改了什么,以便更容易访问 mysql?

回答by MattT

It depends on whether or not you want all user accounts to have access to MySQL, or just you.

For everyone, edit /etc/profile as instructed and add the following to the end:
export PATH=$PATH:usr/local/mysql/bin

这取决于您是希望所有用户帐户都可以访问 MySQL,还是只有您可以访问。

对于每个人,按照说明编辑 /etc/profile 并将以下内容添加到最后:
export PATH=$PATH:usr/local/mysql/bin

For just you (ALSO, this is safest so you don't accidentally mess up any system variables!):

仅对您而言(另外,这是最安全的,因此您不会意外弄乱任何系统变量!):

Get a terminal session: Launch Terminal if it's not already running.

获取终端会话:如果终端尚未运行,则启动终端。

Make sure you're in your home directory:
CD ~

确保您位于主目录中:
CD ~

See if .bash_profile exists:
ls -al .b*

查看 .bash_profile 是否存在:
ls -al .b*

If it does, open it with your favorite text editor. If it doesn't, launch your favorite text editor and Save as... .bash_profilein your home folder.

如果是,请使用您喜欢的文本编辑器打开它。如果没有,请启动您最喜欢的文本编辑器并.bash_profile在您的主文件夹中另存为...。

Add this line to .bash_profile and Save:
export PATH=$PATH:/usr/local/mysql/bin

将此行添加到 .bash_profile 并保存:
export PATH=$PATH:/usr/local/mysql/bin

Then close Terminal and open again for the change to take effect.

然后关闭终端并再次打开以使更改生效。


Hope this works out for you.


希望这对你有用。