在 Mac 10.8.5 上检查 mySQL 版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19462438/
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
Check mySQL version on Mac 10.8.5
提问by user2626498
How can I check (step-by-step ) the version of mySQL installed on my Mac 10.8.5?
如何检查(逐步)我的 Mac 10.8.5 上安装的 mySQL 版本?
I tried using command prompt, but couldn't figure out.
我尝试使用命令提示符,但无法弄清楚。
回答by wens
Every time you used the mysql console, the version is shown.
每次使用 mysql 控制台时,都会显示版本。
$ mysql -u user
Successful console login shows the following which includes the mysql server version.
成功的控制台登录显示以下内容,其中包括 mysql 服务器版本。
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1432
Server version: 5.5.9-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
You can also check the mysql server version directly by executing the following command:
您也可以通过执行以下命令直接检查mysql服务器版本:
$ mysql --version
You may also check the version information from the mysql console itself using the version variables:
您还可以使用版本变量从 mysql 控制台本身检查版本信息:
mysql> SHOW VARIABLES LIKE "%version%";
Output will be something like this:
输出将是这样的:
+-------------------------+---------------------+
| Variable_name | Value |
+-------------------------+---------------------+
| innodb_version | 1.1.5 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.9-log |
| version_comment | Source distribution |
| version_compile_machine | i386 |
| version_compile_os | osx10.4 |
+-------------------------+---------------------+
7 rows in set (0.01 sec)
You may also use this:
你也可以使用这个:
mysql> select @@version;
The STATUS command display version information as well.
STATUS 命令也显示版本信息。
mysql> STATUS
You can also check the version by executing this command:
您还可以通过执行以下命令来检查版本:
mysql -v
If you have encountered something like this:
如果你遇到过这样的事情:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
You can fix it by:
您可以通过以下方式修复它:
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
回答by J Woodchuck
To check your MySQL version on your mac, navigate to the directory where you installed it (default is usr/local/mysql/bin) and issue:
要在 Mac 上检查 MySQL 版本,请导航到安装它的目录(默认为 usr/local/mysql/bin)并发出:
./mysql --version
Alternatively, to avoid needing to navigate to that specific dir to run the command, add its location to your path. There's more than one way to add a dir to your $PATH (with explanations on stackoverflow and other places on how to do so), such as adding it to your ./bash_profile.
或者,为了避免需要导航到该特定目录来运行命令,请将其位置添加到您的路径中。有不止一种方法可以将目录添加到您的 $PATH(在 stackoverflow 和其他地方有关于如何这样做的解释),例如将它添加到您的 ./bash_profile。
After adding the mysql bin dir to your $PATH, verify it's there by executing:
将 mysql bin 目录添加到 $PATH 后,通过执行以下命令验证它是否存在:
echo $PATH
Thereafter you can check your mysql version from anywhere by running (note no "./"):
此后,您可以通过运行(注意没有“./”)从任何地方检查您的 mysql 版本:
mysql --version
回答by Anton Ruban
Or just call mysql
command with --version
option.
或者只是调用mysql
带有--version
选项的命令。
mysql --version
回答by RottenRonnie
You should be able to open terminal and just type
您应该能够打开终端并输入
mysql -v
mysql -v