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 RPM 方式安裝 MySQL 4.0 完整步驟與驗證

編輯:Linux 教學

雖然 MySQL 4.0 已停止維護,但在舊系統遷移、相容性測試場景仍有參考價值。本文記錄雙 RPM 包 (MySQL-server、MySQL-client) 離線安裝、服務啟動、埠驗證全流程。

下載 RPM 包

  • MySQL-server-4.0.16-0.i386.rpm
  • MySQL-client-4.0.16-0.i386.rpm
  • 來源:https://downloads.mysql.com/archives/community/ 選擇 Linux x86 RPM

安裝參數說明

rpm -ivh 包名
# -i install
# -v verbose
# -h hash marks (進度條 #)

安裝 Server 端

rpm -ivh MySQL-server-4.0.16-0.i386.rpm

# 輸出關鍵資訊:
# warning: V3 DSA signature: NOKEY, key ID 5072e1f5  (簽名未驗證,非錯誤)
# Starting mysqld daemon with databases from /var/lib/mysql
# 設定 root 密碼提示:
# /usr/bin/mysqladmin -u root password 'new-password'
# /usr/bin/mysqladmin -u root -h hostname password 'new-password'

驗證服務啟動

netstat -nat
# Proto Recv-Q Send-Q Local Address Foreign Address State
# tcp  0  0  0.0.0.0:3306  0.0.0.0:*  LISTEN
# 3306 監聽即代表服務正常啟動

安裝 Client 端

rpm -ivh MySQL-client-4.0.16-0.i386.rpm
# Preparing... ########################################### [100%]
# 1:MySQL-client ########################################### [100%]

後續必要動作

  1. 設定 root 密碼
    /usr/bin/mysqladmin -u root password 'StrongP@ssw0rd'
  2. 測試連線
    mysql -uroot -p
    # Welcome to the MySQL monitor...
  3. 配置開機自啟
    chkconfig --add mysql
    chkconfig mysql on
  4. 防火牆開放 3306
    iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
    service iptables save

常見問題

  • 簽名警告:warning: V3 DSA signature: NOKEY 僅表示未匯入 GPG 公鑰,不影響安裝。可 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql 解決。
  • 資料目錄權限:/var/lib/mysql 擁有者需為 mysql:mysql,安裝程式通常自動處理。
  • 舊版相容性:MySQL 4.0 不支援 InnoDB 熱備份、觸發器、視圖、存儲過程,僅適合極度老舊應用維護。

RPM 安裝 MySQL 三步走:裝 Server → 驗證 3306 → 裝 Client → 設密碼 → 自啟 → 開牆。現代系統請改用 MySQL 8.0+ 官方 YUM/APT 倉庫或 Docker 部署。

Copyright © Windows教程網 All Rights Reserved