|
各位大神好,小弟是php新手。先介绍下个人问题,这个项目是用ci框架搭建的后台管理系统,数据库使用mysql. 我在部署在内网时出现点错误,在连接数据库的时候密码莫名清空了。 我在/database/drivers/mysql/mysql_driver.php中 db_connect()函数里面写了个日志,
function db_connect()
{
if ($this->port != '')
{
$this->hostname .= ':'.$this->port;
}
log_message('error',"======================");
log_message('error',"hostname=".$this->hostname);
log_message('error',"username=".$this->username);
log_message('error',"password=".$this->password);
log_message('error',"======================");
return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
}
数据库配置在application/config/production/database.php,里面配置了相关的数据库信息。
。在查看日志时发现 (最开始的时候有取到password,后面几次都是password都为空的,不知道为什么)。
ERROR - 2014-12-15 11:05:41 --> hostname=127.0.0.1
ERROR - 2014-12-15 11:05:41 --> username=root
ERROR - 2014-12-15 11:05:41 --> password=******(这次能取到)
ERROR - 2014-12-15 11:05:41 --> ======================
ERROR - 2014-12-15 11:05:41 --> ======================
ERROR - 2014-12-15 11:05:41 --> hostname=127.0.0.1
ERROR - 2014-12-15 11:05:41 --> username=root
ERROR - 2014-12-15 11:05:41 --> password=
ERROR - 2014-12-15 11:05:41 --> ======================
ERROR - 2014-12-15 10:55:04 --> Severity: Warning --> mysql_connect(): Access denied for user 'root'@'127.0.0.1' (using password: NO) /home/hulq/s01/jssg1/login/website/s_jssg/common/cilib/database/drivers/mysql/mysql_driver.php 78
ERROR - 2014-12-15 10:55:04 --> Unable to connect to the database
ERROR - 2014-12-15 10:55:04 --> ======================
ERROR - 2014-12-15 10:55:04 --> hostname=127.0.0.1
ERROR - 2014-12-15 10:55:04 --> username=root
ERROR - 2014-12-15 10:55:04 --> password=
ERROR - 2014-12-15 10:55:04 --> ======================
ERROR - 2014-12-15 10:55:04 --> Severity: Warning --> mysql_connect(): Access denied for user 'root'@'127.0.0.1' (using password: NO) /home/hulq/s01/jssg1/login/website/s_jssg/common/cilib/database/drivers/mysql/mysql_driver.php 78
ERROR - 2014-12-15 10:55:04 --> Unable to connect to the database
研究了很久没发现问题,希望各位大大帮助了一下。
|
|