如何检查和确定MySQL数据库服务器版本?

MySQL or MariaDB is very popular opensource databases servers. While using these database servers we may need to know the version of the client or server. We can use features according to these version numbers. In this tutorial we will look how to list MySQL and MariaDB database server versions.

MySQL或MariaDB是非常流行的开源数据库服务器。 在使用这些数据库服务器时,我们可能需要了解客户端或服务器的版本。 我们可以根据这些版本号使用功能。 在本教程中,我们将研究如何列出MySQL和MariaDB数据库服务器版本。

mysql –version命令 (mysql –version Command)

mysql is a client command used to connect and manage database server. We can use --version option in order to print the version of the mysql client. If the database service runs in the same system this will also print the server version too.

mysql是用于连接和管理数据库服务器的客户端命令。 我们可以使用--version选项来打印mysql客户端的版本。 如果数据库服务在同一系统上运行,这还将打印服务器版本。

$ mysql --version
mysql --version Command
mysql –version Command
mysql –version命令

包装经理(Package Manager)

We can use package manager of the system. This can be apt , yum or dnf. In this case we will use apt with the show option .

我们可以使用系统的程序包管理器。 这可以是aptyumdnf 。 在这种情况下,我们将使用aptshow选项。

$ apt show mysql-server
Package Manager
Package Manager
包装经理

As we can see from line Version: the version is 5.7.23

正如我们从Version:行看到的Version:版本是5.7.23

MySQL客户端 (MySQL Client)

In the first connection of the MySQL server some basic information about the server is listed. MySQL server version is one of them. The line starting with Server version: will show the current version of the MySQL server.

在MySQL服务器的第一个连接中,列出了有关服务器的一些基本信息。 MySQL服务器版本就是其中之一。 以Server version:开头的行将显示MySQL服务器的当前版本。

$ sudo mysql -u root -p
MySQL Client
MySQL Client
MySQL客户端

服务器变量(Server Variables)

MySQL server variables are stored  in the VARIABLES variable. We can use  VARIABLES and fileter for version information like and SQL statement.

MySQL服务器变量存储在VARIABLES变量中。 我们可以使用VARIABLES和fileter来获取version信息,例如SQL语句。

> SHOW VARIABLES LIKE "%version%";
Server Variables
Server Variables
服务器变量

As we can see also following information is provided too.

如我们所见,还提供了以下信息。

  • innodb_version

    innodb_version
  • protocol_version

    protocol_version
  • tls_version

    tls_version
  • version

  • version_comment

    版本评论
  • version_compile_machine

    version_compile_machine
  • version_compile_os

    version_compile_os

状态MySQL命令 (STATUS MySQL Command)

MySQL also provides the STATUS command which is used to current status of the MySQL server. We can this command to print MySQL server version and other server related information like Connection, Current User, Connection Id etc.

MySQL还提供STATUS命令,该命令用于显示MySQL服务器的当前状态。 我们可以使用此命令来打印MySQL服务器版本和其他与服务器相关的信息,例如连接,当前用户,连接ID等。

> STATUS;
STATUS MySQL Command
STATUS MySQL Command
状态MySQL命令

As we can see that following information is provided too

如我们所见,还提供了以下信息

  • Connection id

    连接ID
  • Current database

    当前数据库
  • Current user

    当前用户
  • SSL

    SSL协议
  • Server version

    服务器版本
  • Protocol version

    协议版本
  • Connection

    连接
  • Server characterset

    服务器角色集
  • Db     characterset

    db characterset
  • Client characterset

    客户特征集
  • Conn.  characterset

    连接字符集
  • UNIX socket

    UNIX套接字
  • Uptime

    正常运行时间
  • Threads

    线程数
LEARN MORE  How To Connect MySQL/MariaDB Server From Command Line On Linux and Windows?
了解更多如何在Linux和Windows上从命令行连接MySQL / MariaDB服务器?

翻译自: https://www.poftut.com/how-to-check-and-determine-mysql-database-server-version/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值