数据库错误PDOException错误:SQLSTATE [HY000] [1045]

时间:2019-05-20 17:29:43

标签: mysql apache ubuntu cakephp

我在服务器上配置网站时遇到了CakePHP 3错误,但是当我将浏览器指向某个链接时,它给了我这个错误:

Error: SQLSTATE[HY000] [1045] Access denied for user 'rapidvolley'@'localhost' (using password: YES)

If you are using SQL keywords as table column names, you can enable identifier quoting for your database connection in
     

config / app.php。

If you want to customize this error message, create src/Template/Error/pdo_error.ctp

enter image description here

1 个答案:

答案 0 :(得分:0)

解决了该问题,使用了以下数据库主机名连接:

'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',     
            'username' => 'username',
            'password' => 'password ', 
            'database' => 'DB name',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'quoteIdentifiers' => false,
            'log' => false,
            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
            'url' => env('DATABASE_TEST_URL', null),