哪个命令返回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
其他回答
对于Mac,
登录mysql服务器。 执行如下命令: 显示变量“%版本%”;
我找到了一个简单的方法。
例如: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。
请找到这份有用的参考资料。
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)
很多答案建议使用mysql——version。但是mysql程序是客户端。服务器为mysqld。所以命令应该是
mysqld --version
or
mysqld --help
这在Debian和Windows上都适用。
当你用客户端连接到MySQL服务器时,你可以使用
select version()
or
select @@version
在windows下,打开命令提示符,输入MySQL -V或MySQL——version。如果您使用Linux get终端并输入MySQL -v