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


当前回答

对于Mac,

登录mysql服务器。 执行如下命令: 显示变量“%版本%”;

其他回答

对于Mac,

登录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>

这里还有两个方法:

Linux: Mysql视图版本:从PHP

从PHP函数中,我们可以看到使用的版本:

mysql_get_server_info ([resource $ link_identifier = NULL]): string

Linux: Mysql view version:包的版本号

对于RedHat / CentOS操作系统:

rpm -qa | grep mysql

对于Debian / Ubuntu操作系统:

rpm -qa | grep mysql

摘自:https://www.sysadmit.com/2019/03/linux-mysql-ver-version.html

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页

mysqladmin版本或mysqladmin -V