我的操作系统是在XP下用虚拟机模拟Ubuntu 8.04系统,安装好LAMP(包括phpmyadmin),在/usr/share/phpmyadmin目录下有两个配置文件,分别是 config.sample.inc.php 和 config.inc.php,里面的内容也不一样。
如下:
config.inc.php
++++++++++++++++++++++++++++++++++++++++++
<?php
/**
* Please, do not edit this file. The configuration file for Debian
* is located in the /etc/phpmyadmin directory.
*/
// Load secret generated on postinst
include('/var/lib/phpmyadmin/blowfish_secret.inc.php');
// Load autoconf local config
include('/var/lib/phpmyadmin/config.inc.php');
// Load user's local config
include('/etc/phpmyadmin/config.inc.php');
// Set the default server if there is no defined
if (!isset($cfg['Servers'])) {
$cfg['Servers'][1]['host'] = 'localhost';
}
// Set the default values for $cfg['Servers'] entries
for ($i=1; (!empty($cfg['Servers'][$i]['host']) || (isset($cfg['Servers'][$i]['connect_type']) && $cfg['Servers'][$i]['connect_type'] == 'socket')); $i++) {
if (!isset($cfg['Servers'][$i]['auth_type'])) {
$cfg['Servers'][$i]['auth_type'] = 'cookie';
}
if (!isset($cfg['Servers'][$i]['host'])) {
$cfg['Servers'][$i]['host'] = 'localhost';
}
if (!isset($cfg['Servers'][$i]['connect_type'])) {
$cfg['Servers'][$i]['connect_type'] = 'tcp';
}
if (!isset($cfg['Servers'][$i]['compress'])) {
$cfg['Servers'][$i]['compress'] = false;
}
if (!isset($cfg['Servers'][$i]['extension'])) {
$cfg['Servers'][$i]['extension'] = 'mysql';
}
}
+++++++++++++++++++++++++++++++++++++++++++++++
config.sample.inc.php的内容如
http://hi.baidu.com/xblogs/blog/item/11ca1f507a3ffb6784352491.html所示
(篇幅有限,抱歉)
请问他们两个是什么关系?哪个才是真正的配置文件?要删除哪一个么?
但是两个文件里面的东西完全没用相似的地方,我怕原来的config文件也是有用的
在里面添加上 if (!isset($cfg['Servers'][$i]['host'])) {
$cfg['Servers'][$i]['host'] = 'localhost';
}
if (!isset($cfg['Servers'][$i]['user'])) {
$cfg['Servers'][$i]['host'] = 'root';
}
if (!isset($cfg['Servers'][$i]['password'])) {
$cfg['Servers'][$i]['password'] = '你的数据库密码';
}
只要里面有个这些东西 两个文件都可以用 我以前也有这个问题 我就试了下 然后就发现都是可以的 解决了记得给我加分啊 O(∩_∩)O哈哈~
参考资料:我的经验 :-)