在本地环境中,如果每次打开phpmyadmin都要输入用户名和密码,是不是很讨厌?别着急,马上让你摆脱烦恼。
先来看一下几个参数:
$cfg[‘Servers’][$i][‘auth_type’] 字符串 [‘http’|’cookie’|’config’]
选择 config、cookie 或者 http 认证。
* ‘config’ 认证($auth_type = ‘config’)是最简单的模式,用户名和密码存储在 config.inc.php 文件里;
* ‘cookie’ 认证模式($auth_type = ‘cookie’)2.2.3 以上版本允许您通过 cookie,以任何合法的 MySQL 用户登录。
用户名和密码存储在 cookie 中,注销后将删除密码。也可以使您登录任意的服务器(需要打开 $cfg[‘AllowArbitraryServer’] 参数)。
* ‘http’ 认证(在老版本叫做 ‘advanced’)($auth_type = ‘http’)1.3.0 以上版本允许您通过 HTTP-Auth,以任何有效的 MySQL 用户登录。
请查阅文档的 安装章节 的 “Using authentication modes” 获取更多信息。
$cfg[‘Servers’][$i][‘user’] 字符串
$cfg[‘Servers’][$i][‘password’] 字符串
如果 auth_type = ‘config’,phpMyAdmin 将使用这个账户来连接 MySQL 服务器。
如果您使用 HTTP 或者 cookie 认证,请不要填写这个账户。
对于root用户的设置:
$cfg[‘Servers’][$i][‘AllowRoot’] = true; 是否允许用root用户登录
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true; 是否允许root用户密码为空
设置说明:
下载最新版的phpMyAdmin包,解压到网站根目录,进入phpMyAdmin的目录找到libraries下面的config.default.php文件,打开,可以看见大大的[DO NOT EDIT]字样,哈哈,我就是要DO IT!!!!
改这里的几个参数:
$cfg[‘Servers’][$i][‘host’] = ‘192.168.1.9’; //数据库服务器地址
$cfg[‘Servers’][$i][‘auth_type’] = ‘config’; //改成config模式
$cfg[‘Servers’][$i][‘user’] = ‘root’; //数据库用户名
$cfg[‘Servers’][$i][‘password’] = ‘**‘; //密码
$cfg[‘Servers’][$i][‘AllowRoot’] = true; //是否允许用root用户登录
$cfg[‘Servers’][$i][‘AllowNoPassword’] = true; //是否允许root用户密码为空
保存,OK,在浏览器里输入phpMyAdmin的URL就可以直接进入管理界面了,这样就省了每回输入用户名密码的麻烦,嘿嘿, 但是上线后一定要删除啊!!!