www*_*com 31 php mysql cookies login phpmyadmin
我们想在phpMyAdmin中自动登录用户.现在我们有一个用PHP编写的Web界面.用户可以登录.登录后,他们可以单击SQL打开phpMyAdmin的菜单中的链接.有没有办法自动登录?是否可以为phpMyAdmin设置cookie或让它们使用它?我们不想关闭phpMyAdmin的登录信息; 每个用户都有自己的MySQL用户/通行证组合.所以我们需要将用户名/密码设置传递给phpMyAdmin.
Aru*_*aha 56
在/*身份验证类型*/下面的config.inc.php中添加代码.它存在于根文件夹中
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
Run Code Online (Sandbox Code Playgroud)
abs*_*ive 26
编辑config.inc.php
位置:/etc/phpmyadmin/config.inc.php
找到吹码
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Run Code Online (Sandbox Code Playgroud)
并用吹码代替代码行
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['username'] = 'root';
$cfg['Servers'][$i]['password'] = 'your_password';
Run Code Online (Sandbox Code Playgroud)
如果您的密码为null或''取消注释吹线
//$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Run Code Online (Sandbox Code Playgroud)
至
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Run Code Online (Sandbox Code Playgroud)
然后它会工作正常!
mar*_*kus 24
您只需在名为的字段pma_username和密码中发布用户名即可pma_password.或者,如果您使用的是http身份验证模式,则可以使用用户名和密码创建链接http://user:pass@www.host.com/phpmyadmin/...
小智 5
config.inc.php
/* Authentication type */
if ($_SERVER["REMOTE_ADDR"] == '::1') {
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'user';
$cfg['Servers'][$i]['password'] = 'password';
} else {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
Run Code Online (Sandbox Code Playgroud)
$ _SERVER [“ REMOTE_ADDR”] ==':: 1'(ipv6)
$ _SERVER [“ REMOTE_ADDR”] =='127.0.0.1'(ipv4)
| 归档时间: |
|
| 查看次数: |
27719 次 |
| 最近记录: |