哪个命令返回MySQL数据库的当前版本?
当前回答
对于UBUNTU,您可以尝试以下命令来检查mysql版本:
mysql --version
其他回答
只有这个代码对我有用
/usr/local/mysql/bin/mysql -V
您还可以在第一次登录时查看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>
try
mysql --version
例如。或dpkg -l 'mysql-server*'。
很多答案建议使用mysql——version。但是mysql程序是客户端。服务器为mysqld。所以命令应该是
mysqld --version
or
mysqld --help
这在Debian和Windows上都适用。
当你用客户端连接到MySQL服务器时,你可以使用
select version()
or
select @@version
简单的登录到Mysql用
mysql -u root -p
然后输入这个命令
select @@version;
得到的结果是,
+-------------------------+
| @@version |
+-------------------------+
| 5.7.16-0ubuntu0.16.04.1 |
+-------------------------+
1 row in set (0.00 sec)