-1

嗨,当我使用 PDO 连接时,我是 PDO 连接的新手,我收到了那个错误

异常“PDOExecption”,消息“SQLSTATE [42000] [1044]”拒绝用户“@localhost”访问数据库“dev2anal_calltrack”,“root”,“在该文件中”

global $DB_HOST,$DB_NAME,$DB_USER,$DB_PASS;
$this->db = new Real_PDO("mysql:host=localhost;dbname=dev2anal_calltrack,root,");
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

通常root拥有所有权限,我也检查..

4

2 回答 2

1
new Real_PDO("mysql:host=localhost;dbname=dev2anal_calltrack",'root');
                                          move a quote here ^
于 2013-07-22T11:25:39.883 回答
0

应该:

$this->db = new Real_PDO("mysql:host=localhost;dbname=dev2anal_calltrack", 'root');

错位的逗号。

于 2013-07-22T11:24:54.067 回答