如何配置phpmyadmin,使它打开后自动登陆(不需要输入用户名和密码)

首先在根目录找到config.sample.inc.php复制一份文件名改为config.inc.php(如果已经存在 config.inc.php 文件,则直接修改该文件即可)。打开config.inc.php 找到 cfg\['Servers'\]\[i]['auth_type'],将

|---|------------------------------------------------------------------|
| 1 | $cfg``[``'Servers'``][``$i``][``'auth_type'``] = ``'cookie'``; |

改成

|---|------------------------------------------------------------------|
| 1 | $cfg``[``'Servers'``][``$i``][``'auth_type'``] = ``'config'``; |

然后在下面追加如下代码:

|-----|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 | $cfg[``'Servers'``][``$i``][``'user'``] = ``'root'``; ``// 设置的mysql用户名 $cfg``[``'Servers'``][``$i``][``'password'``] = ``'123456'``; ``// 设置的mysql密码 |

取消phpMyAdmin自动登录

只需把

|---|------------------------------------------------------------------|
| 1 | $cfg``[``'Servers'``][``$i``][``'auth_type'``] = ``'config'``; |

改成

|---|------------------------------------------------------------------|
| 1 | $cfg``[``'Servers'``][``$i``][``'auth_type'``] = ``'cookie'``; |

保存即可。

cfg\['Servers'\]\[i]['auth_type'] 有三个待选项值,即 cookie、http、config。用的比较多的是 cookie与config。当在正式环境时,用 cookie,要求用户必须输入正确的用户名与密码,而在本地测试服务器时,一般用 config,省得session失效后又得输入用户名与密码,以节省开发时间。

相关推荐
**蓝桉**31 分钟前
mysql二进制部署
mysql
夕除1 小时前
Mysql--07
数据库·mysql
顶点多余1 小时前
Mysql--后端与前端关系
数据库·mysql
mygljx1 小时前
【MySQL 的 ONLY_FULL_GROUP_BY 模式】
android·数据库·mysql
sunwenjian8862 小时前
Springboot项目本地连接并操作MySQL数据库
数据库·spring boot·mysql
我不听你讲话2 小时前
LNMP网络服务搭建
linux·php·apache
Mr. Cao code3 小时前
MySQL服务器配置与socket连接详解
服务器·数据库·mysql
Yupureki3 小时前
《MySQL数据库基础》1. 数据库基础
c语言·开发语言·数据库·c++·mysql·oracle·github
xyyaihxl3 小时前
【MySQL】复合查询
数据库·mysql
未来龙皇小蓝3 小时前
【MySQL-索引调优】02:单列索引
数据库·mysql·性能优化