哪个命令返回MySQL数据库的当前版本?
当前回答
E:\>mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1026
Server version: 5.6.34-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> select @@version;
+------------+
| @@version |
+------------+
| 5.6.34-log |
+------------+
1 row in set (0.00 sec)
其他回答
试试这个功能-
SELECT VERSION();
-> '5.7.22-standard'
(版本)
或更多细节使用:
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参考手册(pdf) -确定您当前的MySQL版本-第42页
很多答案建议使用mysql——version。但是mysql程序是客户端。服务器为mysqld。所以命令应该是
mysqld --version
or
mysqld --help
这在Debian和Windows上都适用。
当你用客户端连接到MySQL服务器时,你可以使用
select version()
or
select @@version
您还可以在第一次登录时查看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>
转到MySQL工作台并登录到服务器。在MANAGEMENT下有一个名为Server Status的字段。单击Server Status并查找版本。
或者转到以下位置,打开cmd -> c:\ windows \ system32 \cmd.exe然后点击命令-> mysql - v
从控制台你可以尝试:
mysqladmin version -u USER -p PASSWD