哪个命令返回MySQL数据库的当前版本?


当前回答

try

mysql --version

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

其他回答

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

我找到了一个简单的方法。

例如:Unix命令(这样你就不需要2个命令了),

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

示例输出:

+-------------------------+-------------------------+
| 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        |
+-------------------------+-------------------------+

在上述情况下,mysql版本为5.5.49。

请找到这份有用的参考资料。

Xampp与Windows用户在下面的命令中工作在mysql目录。

您还可以在第一次登录时查看MySQL shell的顶部。它实际上在这里显示了版本。

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 67971
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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>

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

mysql --version