在终端的mac中找不到mysql命令

时间:2014-05-07 14:17:12

标签: mysql macos bash terminal

我刚从这个site安装了mysql,并且成功了。但当我尝试在终端上使用命令mysql -u root -ppassword打开时,它显示-bash: mysql: command not found

但是当我尝试下面的时候,我能够成功登录到mysql。

/usr/local/mysql/bin/mysql -u root -ppassword

那么我应该只使用mysql代替/usr/local/mysql/bin/mysql。 (顺便说一下,我是Mac新手)

3 个答案:

答案 0 :(得分:0)

您可以更新.profile或.bashrc文件,将目录/ usr / local / mysql / bin包含在PATH变量中。此外,您还可以创建指向PATH变量中已有位置的符号链接。

答案 1 :(得分:0)

Just do the following in terminal:

Type cd

drag the path on to the terminal where the dmg exists

Type /usr/LOCAL/mysql/BIN/mysql -h host -u user -p

(host=hostname user=username to login to access database)

On giving valid credentials, you will be prompted for password

On giving valid password,it will be displayed with Welcome to mysql monitor and soon.. with the below prompt

mysql>

答案 2 :(得分:0)