$cfg['blowfish_secret']必须严格为32字符、位于$cfg['Servers']配置之前、且auth_type必须设为'cookie',三者缺一不可;否则phpMyAdmin页面底部将持续提示错误。
因为 $cfg['blowfish_secret'] 缺失、为空、长度不足 32 字符,或写在了 config.inc.php 中错误的位置——它不是可选项,而是 cookie 认证模式下的硬性要求。
config.inc.php 里 $cfg['blowfish_secret'] 必须严格满足 32 字符
phpMyAdmin 4.9+ 强制校验该值长度为 exactly 32 字符。填 '123'、'xampp'、空字符串 '' 或 31/33 字符都会触发提示,且不报具体错误信息。
- 用终端安全生成(Linux/macOS):
openssl rand -base64 32 | tr -d '\n'; echo - Windows 可用 PHP 脚本:
echo bin2hex(random_bytes(16));(再补足到 32 字符) - 粘贴进配置时:确保单引号内无空格、制表符、换行;末尾有分号;不能被注释
$cfg['blowfish_secret'] 必须写在 $cfg['Servers'] 配置之前
phpMyAdmin 启动时按顺序读取配置,$cfg['blowfish_secret'] 必须出现在任何 $cfg['Servers'][$i] 块之前,否则直接忽略。
- ✅ 正确位置示例:
$cfg['blowfish_secret'] = '...'; $i = 0; $cfg['Servers'][$i]['auth_type'] = 'cookie'; - ❌ 常见错误:写在
$i++之后、写在/* End of servers configuration */注释下方、或写在$cfg['Servers'][$i]初始化之后
auth_type 不是 'cookie' 时,$cfg['blowfish_secret'] 不生效
如果 $cfg['Servers'][$i]['auth_type'] 是 'config'(即自动用 root 密码登录),整个 cookie 加密流程不会启动,改了密钥也毫无作用。
- 必须显式设为:
$cfg['Servers'][$i]['auth_type'] = 'cookie'; - 该设置通常在 config.inc.php 靠后位置,搜索
auth_type即可定位 - 改完需重启 Apache(XAMPP 控制面板点 Restart,或执行
sudo /opt/lampp/lampp restart)
浏览器 cookie 和文件权限也会干扰生效
即使配置全对,旧 cookie 或文件权限问题仍会导致“看似修复实则无效”。
立即学习“PHP免费学习笔记(深入)”;
- 清除浏览器中所有
pmaAuth-开头的 cookie,或换无痕窗口重试 - Linux/macOS 下确认
config.inc.php权限为644(非 777),且属主可读 - 检查是否误改了
config.default.php或config.sample.inc.php—— 这两个文件根本不会被加载
最容易被忽略的是:密钥长度必须恰好 32 字符 + 位置必须在 $cfg['Servers'] 之前 + auth_type 必须为 cookie。三者缺一,页面底部就会固执地显示那句提示。



















