Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux 查看 MariaDB 伺服器版本三種方法:登入後顯示、status 指令、套件管理器查詢套件版本

編輯:關於 Linux

掌握 MariaDB 版本資訊對漏洞修補、相容性驗證、升級規劃至關重要。本文提供三種查詢方式:登入客戶端自動顯示、SQL status / SELECT VERSION()、套件管理器查詢安裝套件版本 (rpm/dpkg/apt)。

MariaDB 登入版本顯示

status 指令輸出

套件版本查詢

方法一:登入客戶端 (最直觀)


$ mysql -u root -p
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 123
Server version: 10.5.23-MariaDB-0ubuntu0.22.04.1 (Ubuntu)
...

方法二:SQL 指令 (腳本自動化適用)


# 登入後
MariaDB [(none)]> status;
--------------
mysql  Ver 15.1 Distrib 10.5.23-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Connection id: 123
Server version: 10.5.23-MariaDB-0ubuntu0.22.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
...

# 或純 SQL
MariaDB [(none)]> SELECT VERSION();
+----------------------------------+
| VERSION()                        |
+----------------------------------+
| 10.5.23-MariaDB-0ubuntu0.22.04.1 |
+----------------------------------+

方法三:套件管理器查詢 (無法登入資料庫時)


# RHEL/CentOS/Fedora
rpm -qa | grep -i mariadb
# mariadb-server-10.5.23-1.el9.x86_64
# mariadb-10.5.23-1.el9.x86_64

# Debian/Ubuntu
dpkg -l | grep mariadb
# ii  mariadb-server-10.5    1:10.5.23-0ubuntu0.22.04.1

# 查詢可用升級版本
apt list --upgradable | grep mariadb
dnf check-update mariadb

版本號解讀

  • 10.5.23:上游 MariaDB 版本 (Major.Minor.Patch)。
  • -0ubuntu0.22.04.1:下游發行版打包修訂號 (Ubuntu 22.04 第 1 次修訂)。
  • 關注 Major.Minor 確認功能相容性,Patch 確認安全修補。

三種方法互補,確保在任何環境 (有/無資料庫存取權、有/無 Shell) 都能快速獲取版本資訊。

Copyright © Windows教程網 All Rights Reserved