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

phpMyAdmin 生產環境配置最佳實踐

     編輯:MySQL 資料庫相關知識

認證模式選擇:安全與便利的平衡

phpMyAdmin 提供三種認證方式,生產環境強烈建議採用 cookie 模式:

  • config:明文寫死帳密,零安全性,僅適合離線測試。
  • http:借用 Web Server Basic Auth,但 CGI/FastCGI 模式下 PHP 無法取得認證變數,相容性差。
  • cookie:PHP 內建登入表單,需設定 $cfg['blowfish_secret'] 加密 Cookie,支援所有現代瀏覽器,安全且通用。
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['blowfish_secret'] = 'your_random_string_here'; // 必填

大檔案匯入匯出突破 2MB 限制

預設受限於 PHP upload_max_filesize。解決方案:在 phpMyAdmin 根目錄建立 ports 目錄(需寫入權限),配置:

$cfg['UploadDir'] = 'ports';
$cfg['SaveDir'] = 'ports';

操作完成後務必清空目錄,防止備份檔洩露。

介面微調提升可讀性

修改 css/phpmyadmin.css.php 固定字體大小,避免動態計算開銷:

html { font-size: 11px; }

11px 為多數螢幕最佳閱讀體驗。

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