phpMyAdmin 採用 Cookie 認證模式時,需在設定檔定義 $cfg['blowfish_secret'] 作為加密金鑰,用於加密儲存在瀏覽器 Cookie 中的登入憑證。若未設定或留空,介面會顯示警告:「配置文件現在需要絕密的短語密碼 (blowfish_secret)」。
路徑通常為 phpMyAdmin/config.inc.php(舊版為 config.inc.php3)。
<?php
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['blowfish_secret'] = 'your_random_string_here'; // 自訂任意字串,建議 32 字元以上
?>
openssl rand -base64 32$cfg['blowfish_secret'] = 'a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6';config.inc.php 僅限擁有者讀寫(chmod 600),防洩漏金鑰。config.user.inc.php 覆蓋機制(新版支援)。pmaAuth-* Cookie 內容為加密字串而非明文若仍出現「無法載入 mcrypt 擴展」警告,請安裝 php-mcrypt(PHP 7.1 以下)或確認 sodium 擴展已啟用(PHP 7.2+),以獲得更強的加密效能。