首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫

phpMyAdmin 2.11.5 配置完整指南:從下載到登入驗證

     編輯:MySQL 資料庫相關知識

針對 phpMyAdmin 2.11.5 版本(較舊,現行建議用 5.x),記錄配置關鍵步驟,原理同適用於新版。

1. 部署

  1. 下載 phpMyAdmin-2.11.5.tar.gz,解壓至 Web 根目錄。
  2. 重命名目錄為 phpmyadmin(或自訂名稱,避免預設名稱被掃描)。

2. 編輯 libraries/config.default.php

注意:新版建議複製 config.sample.inc.php 為 config.inc.php 修改,勿動原檔。

參數設定值說明
$cfg['PmaAbsoluteUri']'https://your-domain.com/phpmyadmin'完整存取 URL,必須正確否則重導向失敗
$cfg['Servers'][$i]['auth_type']'cookie'生產環境必用 cookie/http,避免 config 明文帳密
$cfg['Servers'][$i]['user']'your_db_user'資料庫連線帳號
$cfg['Servers'][$i]['password']'your_db_pass'auth_type=config 時生效;cookie 模式由登入表單輸入
$cfg['blowfish_secret']'long_random_string_32chars+'Cookie 加密金鑰,長度 ≥ 32 字元,隨機生成
$cfg['DefaultLang']'zh-tw'介面語言(繁體中文)
$cfg['DefaultCharset']'utf-8'預設字元集
$cfg['Servers'][$i]['host']'localhost'MySQL 伺服器位址

3. 新版額外必要設定(config.inc.php)

<?php
$cfg['blowfish_secret'] = 'your_32_char_random_string_here'; // 必填
$i = 0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false; // 禁止無密碼登入
?>

4. 目錄權限與安全

  • chmod 755 phpmyadmin、chmod 644 config.inc.php。
  • 以 `.htaccess` 或 Nginx `location` 限制存取 IP/基本認證。
  • 定期更新至最新版修補 CVE(舊版 2.11.5 已停止維護,強烈建議升級)。

5. 驗證登入

瀏覽器訪問 https://your-domain.com/phpmyadmin/,輸入資料庫帳號密碼即可進入管理介面。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved