自动登录 phpMyAdmin

2022-08-30 10:39:28

我们希望在phpMyAdmin中自动登录用户。现在我们有一个用PHP编写的Web界面。用户可以登录。登录后,他们可以单击打开phpMyAdmin的菜单中的链接。有没有办法自动登录?是否可以为phpMyAdmin设置cookie或其他东西来让他们使用它?我们不想关闭phpMyAdmin的登录;每个用户都有自己的MySQL用户/通道组合。因此,我们需要将用户名/密码设置传递给phpMyAdmin。SQL


答案 1

在 config.inc.php下面的 /* 身份验证类型 */ 中添加代码。它存在于根文件夹中

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; 

答案 2

Edit config.inc.php

位置 : /etc/phpmyadmin/config.inc.php

查找吹气代码

$cfg['Servers'][$i]['auth_type'] = 'cookie';

并用吹码替换代码行

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'your_password';

如果您的密码为空或“”,则取消注释吹气线

//$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

然后它会正常工作!


推荐