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


当前回答

用CLI一行:

Mysql——user=root——password=pass——host=localhost db_name——execute='select version()';

or

Mysql -uroot -ppass -hlocalhost db_name -e 'select version()';

返回如下内容:

+-----------+
| version() |
+-----------+
| 5.6.34    |
+-----------+

其他回答

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

用CLI一行:

Mysql——user=root——password=pass——host=localhost db_name——execute='select version()';

or

Mysql -uroot -ppass -hlocalhost db_name -e 'select version()';

返回如下内容:

+-----------+
| version() |
+-----------+
| 5.6.34    |
+-----------+

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

mysql -version 

Mysql服务器版本:有很多方法可以找到

选择版本();

显示变量“%版本%”;

mysqld——版本

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)

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

mysql --version