1

我收到了这个错误:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)'

然后我去了phpmyadmin,发现了这个:

#1142 - SELECT command denied to user ''@'localhost' for table 'pma_table_uiprefs' 

我该如何摆脱这个错误?是有权限的东西吗?请帮忙

我试过这个..没有工作:

GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';

这是在codeIgniter中:

> $db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';

我试图更改 my.ini 中的密码:

CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';

didnt work
4

1 回答 1

2

It looks you are mixing a couple of things:

GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';

here above the user is user while in your codeIgniter(CI) coed it is $db['default']['username'] = 'root'; user root

Even if you want to keep the same CI code then you need to specify password for user root which currently you are giving blank $db['default']['password'] = '';

于 2012-12-11T10:19:01.863 回答