我正在使用 MAMP,每次登录 phpMyAdmin 时,我都会收到以下错误/警告消息:
配置文件现在需要一个秘密密码(blowfish_secret)。
我以前没有搞过任何这些设置。有人可以澄清这个错误吗?
这是我的数据库服务器上的信息:
服务器:通过 UNIX 套接字的本地主机 服务器类型:MySQL 服务器版本: 5.5.34 - 源分发协议版本:10
这可能会有所帮助, https://wiki.archlinux.org/index.php/PhpMyAdmin#Add_blowfish_secret_passphrase
如果您首次登录 /phpmyadmin(使用之前设置的 MySQL 用户名和密码)时在页面底部看到以下错误消息:
ERROR: The configuration file now needs a secret passphrase (blowfish_secret)
您需要将blowfish密码添加到phpMyAdmin的配置文件中。编辑 /etc/webapps/phpmyadmin/config.inc.php 并在行中插入随机的河豚“密码”
$cfg['blowfish_secret'] = ; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
现在应该看起来像这样:
$cfg['blowfish_secret'] = 'qtdRoGmbc9{8IZr323xYcSN]0s)r$9b_JUnb{~Xz'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
这一切都假设您已经正确创建了配置文件,
cp config.sample.inc.php config.inc.php
配置文件现在需要一个秘密密码(blowfish_secret)。
每次安装 phpmyadmin 后您都会看到此错误。
要解决此问题,只需打开
config.inc.php
(或将 config.sample.inc.php
重命名为 config.inc.php
,如果您尚未这样做)并更改此行
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
到
$cfg['blowfish_secret'] = 'y[/qlva{kNheGD5hfzFLrNoS-ZX\zQ/';
要生成新的河豚秘密,只需点击此https://phpsolved.com/phpmyadmin-blowfish-secret-generator/?g=5d94be5065c70
任何长度为 32 个字符的字符串都可以,示例:
^M5Pk*FD1cQp9*M9!U!@c59p@huqsphZ
所以,你的最终代码将如下所示:
$cfg['blowfish_secret'] = '^M5Pk*FD1cQp9*M9!U!@c59p@huqsphZ';
您可以在线生成,将密码长度设置为32:
对于带有 Nginx 的 Ubuntu 20.04 或 22.04,
第1步:-
在
/etc/phpmyadmin/conf.d
目录中创建一个新的自定义设置文件并将其命名为 pma_secure.php
:
sudo nano /etc/phpmyadmin/conf.d/pma_secure.php
然后将以下内容添加到新文件中:
<?php
# PhpMyAdmin Settings
# This should be set to a random string of at least 32 chars
$cfg['blowfish_secret'] = 'CHANGE_THIS_TO_A_STRING_OF_32_RANDOM_CHARACTERS';
$i=0;
$i++;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['AllowRoot'] = true; //set it false if you want to disable logins by the root MySQL user
?>
第2步:-
将“CHANGE_THIS_TO_A_STRING_OF_32_RANDOM_CHARACTERS”行更新为包含至少 32 个字符的随机字符串。
注意:- 更改将自动应用。您只需注销并登录 PhpMyAdmin 即可。
我在 Ubuntu 22.04 上使用 Apache2 将 phpMyAdmin 更新到新版本时遇到此错误。
转到
/var/lib/phpmyadmin/blowfish_secret.inc.php
并复制 $cfg['blowfish_secret']
的值。
导航至
/usr/share/phpmyadmin
。将 config.sample.inc.php
重命名为 config.inc.ph
p,并使用之前复制的值更新
$cfg['blowfish_secret']
值
config.inc.php