数据库连接问题……

前几天连接都正确,今天连却报错了。。我没改动过任何文件。。。

代码如下:PHP code

function db_connect(){
  $result=new mysqli('localhost','chenzhi','good','bookmarks');
  if(!$result){
      throw new Exception('access denied .');
  }else{
      return $result;
  }
}



错误信息:Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'chenzhi'@'localhost' (using password: YES) in D:\wamp\Apache2.2\htdocs\bookmarks\db_fns.php on line 7


我在cmd下写入:mysql -u chenzhi -p 
  good;是可以访问数据库的

作者: woshichiren   发布时间: 2011-05-17

你是不是修改过密码?

在phpadmin中,修改密码的时候,不要点“生成密码”,点了生成密码就会出现这样的错误

作者: mystery138   发布时间: 2011-05-17