ZF应用程序的数据库问题

时间:2012-03-07 05:54:06

标签: zend-framework

我有一个基于Zend Framework的网站。我想在我的本地计算机上运行该站点。 我正在使用wamp服务器,我为网站创建了数据库。

加载网站时,我收到以下错误:

( ! ) Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'@'localhost' (using password: YES)' in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144
( ! ) PDOException: SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'@'localhost' (using password: YES) in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 129
Call Stack
#   Time    Memory  Function    Location
1   0.0006  368952  {main}( )   ..\index.php:0
2   0.0422  1681728 Zend_Application->bootstrap( )  ..\index.php:20
3   0.0422  1681760 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( )  ..\Application.php:355
4   0.0422  1681760 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:583
5   0.1858  5863392 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( )   ..\BootstrapAbstract.php:619
6   0.1858  5863520 MKLib_Application_Bootstrap_Bootstrap->_initUtf8( ) ..\BootstrapAbstract.php:666
7   0.1970  6299480 Zend_Db_Adapter_Pdo_Abstract->exec( )   ..\Bootstrap.php:60
8   0.1970  6299480 Zend_Db_Adapter_Abstract->getConnection( )  ..\Abstract.php:263
9   0.1970  6299480 Zend_Db_Adapter_Pdo_Mysql->_connect( )  ..\Abstract.php:315
10  0.1970  6299480 Zend_Db_Adapter_Pdo_Abstract->_connect( )   ..\Mysql.php:96
11  0.1970  6299968 PDO->__construct( ) ..\Abstract.php:129
( ! ) Zend_Db_Adapter_Exception: SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'@'localhost' (using password: YES) in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144
Call Stack
#   Time    Memory  Function    Location
1   0.0006  368952  {main}( )   ..\index.php:0
2   0.0422  1681728 Zend_Application->bootstrap( )  ..\index.php:20
3   0.0422  1681760 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( )  ..\Application.php:355
4   0.0422  1681760 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:583
5   0.1858  5863392 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( )   ..\BootstrapAbstract.php:619
6   0.1858  5863520 MKLib_Application_Bootstrap_Bootstrap->_initUtf8( ) ..\BootstrapAbstract.php:666
7   0.1970  6299480 Zend_Db_Adapter_Pdo_Abstract->exec( )   ..\Bootstrap.php:60
8   0.1970  6299480 Zend_Db_Adapter_Abstract->getConnection( )  ..\Abstract.php:263
9   0.1970  6299480 Zend_Db_Adapter_Pdo_Mysql->_connect( )  ..\Abstract.php:315
10  0.1970  6299480 Zend_Db_Adapter_Pdo_Abstract->_connect( )   ..\Mysql.php:96

1 个答案:

答案 0 :(得分:0)

你必须

  1. 在本地MySQL数据库上创建数据库用户devhyper_links
  2. devhyper_links授予对本地MySQL数据库的适当权限
  3. 这样的东西
    GRANT ALL ON db_name.* TO "devhyper_links"@"localhost" IDENTIFIED BY "password";
    FLUSH PRIVILEGES;
    

    请注意,ALL权限可能过于开放。自行决定自定义。

    请参阅http://dev.mysql.com/doc/refman/5.5/en/grant.html#grant-privileges