I've got a vanilla install of XAMPP in OS X. How can I access the mysql command line tool? I've tried typing "mysql" at the command line, and it spits back "-bash: mysql: command not found".
我在OS x中有一个XAMPP的香草安装,如何访问mysql命令行工具?我试过在命令行输入“mysql”,然后返回“-bash: mysql:命令未找到”。
4 个解决方案
#1
30
XAMPP is installed in Mac OS X in the following directory:
XAMPP安装在Mac OS X中的目录如下:
/Applications/XAMPP/
You can look what's inside that directory and run mysql command line tool providing the full path to it:
您可以查看该目录中的内容,并运行mysql命令行工具,提供该目录的完整路径:
$ /Applications/XAMPP/xamppfiles/bin/mysql
If you need, you can modify your PATH environment variable to include XAMPP binaries and you won't need to specify the whole path all the time.
如果需要,可以修改PATH环境变量以包含XAMPP二进制文件,并且不需要一直指定整个路径。
#2
13
-
Open your .profile file in Mac. This can be done by entering the terminal and typing
在Mac中打开.profile文件。这可以通过输入终端和输入来完成
pico ~/.profile
-
Add the following line to your ./profile file. Replace the path where you installed Xampp, however by default this is the route and should work:
向./profile文件添加以下行。替换安装Xampp的路径,但默认情况下这是该路径,应该可以工作:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
-
Open a new terminal window (Recommendation is to quit all terminal windows and then reopen) and type:
打开一个新的终端窗口(建议退出所有终端窗口,然后重新打开),输入:
mysql
That is all, isn't easy!!
就是这样,不容易!
#3
3
Before using the mysql
command, make sure that you start up the server first by running
在使用mysql命令之前,请确保首先通过运行启动服务器
$ mysql.server start
Then you will be able to use the commands mysqladmin
and mysql
.
然后您将能够使用mysqladmin和mysql命令。
To shut it down, run
关闭它,运行
$ mysql.server stop
and to restart just use
要重新启动,只需使用
$ mysql.server restart
Very intuitive.
非常直观。
#4
0
Open terminal and Follow this bellow step to add mysql to your mac environmental variable
打开终端,按照下面的步骤,将mysql添加到您的mac环境变量中。
step 1:
步骤1:
sudo nano ~/.bash_profile
step 2:
步骤2:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
save it by control+x and then y and hit return. That's it!! now close the terminal and reopen
通过ctrl +x保存,然后y点击return。就是这样! !现在关闭终端重新打开
mysql --version
this will tell you which MySQL version you are using with xampp
这将告诉您使用xampp的MySQL版本
#1
30
XAMPP is installed in Mac OS X in the following directory:
XAMPP安装在Mac OS X中的目录如下:
/Applications/XAMPP/
You can look what's inside that directory and run mysql command line tool providing the full path to it:
您可以查看该目录中的内容,并运行mysql命令行工具,提供该目录的完整路径:
$ /Applications/XAMPP/xamppfiles/bin/mysql
If you need, you can modify your PATH environment variable to include XAMPP binaries and you won't need to specify the whole path all the time.
如果需要,可以修改PATH环境变量以包含XAMPP二进制文件,并且不需要一直指定整个路径。
#2
13
-
Open your .profile file in Mac. This can be done by entering the terminal and typing
在Mac中打开.profile文件。这可以通过输入终端和输入来完成
pico ~/.profile
-
Add the following line to your ./profile file. Replace the path where you installed Xampp, however by default this is the route and should work:
向./profile文件添加以下行。替换安装Xampp的路径,但默认情况下这是该路径,应该可以工作:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
-
Open a new terminal window (Recommendation is to quit all terminal windows and then reopen) and type:
打开一个新的终端窗口(建议退出所有终端窗口,然后重新打开),输入:
mysql
That is all, isn't easy!!
就是这样,不容易!
#3
3
Before using the mysql
command, make sure that you start up the server first by running
在使用mysql命令之前,请确保首先通过运行启动服务器
$ mysql.server start
Then you will be able to use the commands mysqladmin
and mysql
.
然后您将能够使用mysqladmin和mysql命令。
To shut it down, run
关闭它,运行
$ mysql.server stop
and to restart just use
要重新启动,只需使用
$ mysql.server restart
Very intuitive.
非常直观。
#4
0
Open terminal and Follow this bellow step to add mysql to your mac environmental variable
打开终端,按照下面的步骤,将mysql添加到您的mac环境变量中。
step 1:
步骤1:
sudo nano ~/.bash_profile
step 2:
步骤2:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
save it by control+x and then y and hit return. That's it!! now close the terminal and reopen
通过ctrl +x保存,然后y点击return。就是这样! !现在关闭终端重新打开
mysql --version
this will tell you which MySQL version you are using with xampp
这将告诉您使用xampp的MySQL版本