如何检索 MySQL 数据库管理系统 (DBMS) 的当前版本?

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

How to retrieve the current version of a MySQL database management system (DBMS)?

mysql

提问by pheromix

What command returns the current version of a MySQL database?

什么命令返回 MySQL 数据库的当前版本?

采纳答案by Paul Spiegel

Many answers suggest to use mysql --version. But the mysqlprogramm is the client. The server is mysqld. So the command should be

许多答案建议使用mysql --version. 但mysql程序是客户端。服务器是mysqld. 所以命令应该是

mysqld --version

or

或者

mysqld --help

That works for me on Debian and Windows.

这在 Debian 和 Windows 上对我有用。

When connected to a MySQL server with a client you can use

当使用客户端连接到 MySQL 服务器时,您可以使用

select version()

or

或者

select @@version

回答by Devart

Try this function -

试试这个功能——

SELECT VERSION();
-> '5.7.22-standard'

VERSION()

版本()

Or for more details use :

或了解更多详情,请使用:

SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name           | Value                                    |
+-------------------------+------------------------------------------+
| protocol_version        | 10                                       |
| version                 | 5.0.27-standard                          |
| version_comment         | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686                                     |
| version_compile_os      | pc-linux-gnu                             |
+-------------------------+------------------------------------------+
5 rows in set (0.04 sec)

MySQL 5.0 Reference Manual (pdf) - Determining Your Current MySQL Version - page 42

MySQL 5.0 参考手册 (pdf) - 确定您当前的 MySQL 版本 - 第 42 页

回答by Michael Krelin - hacker

try

尝试

mysql --version

for instance. Or dpkg -l 'mysql-server*'.

例如。或者dpkg -l 'mysql-server*'

回答by Umesh Kaushik

Use mysql -Vworks fine for me on Ubuntu.

mysql -V在 Ubuntu 上使用对我来说很好用。

回答by John Woo

SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------------------+
| Variable_name           | Value                                    |
+-------------------------+------------------------------------------+
| protocol_version        | 10                                       |
| version                 | 5.0.27-standard                          |
| version_comment         | MySQL Community Edition - Standard (GPL) |
| version_compile_machine | i686                                     |
| version_compile_os      | pc-linux-gnu                             |
+-------------------------+------------------------------------------+
5 rows in set (0.04 sec)

MySQL 5.0 Reference Manual (pdf) - Determining Your Current MySQL Version - page 42

MySQL 5.0 参考手册 (pdf) - 确定您当前的 MySQL 版本 - 第 42 页

回答by tk_

I found a easy way to get that.

我找到了一个简单的方法来获得它。

Example: Unix command(this way you don't need 2 commands.),

示例:Unix 命令(这样您就不需要 2 个命令。),

$ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'

Sample outputs:

示例输出:

+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.5.49                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| version                 | 5.5.49-0ubuntu0.14.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | debian-linux-gnu        |
+-------------------------+-------------------------+

In above case mysql version is 5.5.49.

在上述情况下 mysql 版本是5.5.49

Please find this useful reference.

请找到这个有用的参考

回答by Muhammad waqas muneer

For UBUNTUyou can try the following command to check mysql version :

对于UBUNTU,您可以尝试以下命令来检查 mysql 版本:

mysql --version

回答by Amitesh

Mysql Client version: Please beware this doesn't returns server version, this gives mysql client utility version

Mysql 客户端版本:请注意这不会返回服务器版本,这提供了 mysql 客户端实用程序版本

mysql -version 

Mysql server version :There are many ways to find

mysql服务器版本:有多种查找方式

  1. SELECT version();
  1. SELECT version();

enter image description here

在此处输入图片说明

  1. SHOW VARIABLES LIKE "%version%";
  1. SHOW VARIABLES LIKE "%version%";

enter image description here

在此处输入图片说明

  1. mysqld --version
  1. mysqld --version

回答by Nirojan Selvanathan

Simply login to the Mysql with

只需登录到 Mysql

mysql -u root -p

Then type in this command

然后输入这个命令

select @@version;

This will give the result as,

这将给出结果,

+-------------------------+
| @@version               |
+-------------------------+
| 5.7.16-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.00 sec)

回答by Nanhe Kumar

MySQL Server version

MySQL 服务器版本

shell> mysqld --version

MySQL Client version

MySQL客户端版本

shell> mysql --version

shell> mysql -V