2015-11-03 22 views
0

我用Yii2,DB連接Yii2 Postgres的錯誤 - fe_sendauth:沒有密碼提供

'db' => [ 
    'class' => 'yii\db\Connection', 
    'dsn' => 'pgsql:host=localhost;dbname=data-storage', 
    'username' => 'data-storage', 
    'password' => '', 
    'charset' => 'utf8', 
] 

我的數據庫沒有密碼。我收到了一個錯誤:SQLSTATE [08006] [7] fe_sendauth:沒有提供密碼。 如果我使用一些密碼(只是假的,正如我所說,我沒有它)我得到:密碼驗證失敗的用戶「數據存儲」

pg_hba.conf中我有一個記錄我的域名:
host all all 172.28.3.70/32 trust
對PgAdmin可以正常工作。

+0

幫助:http://stackoverflow.com/questions/17996957/fe-sendauth-no-password-supplied –

回答

0

我想通了,我已經使用本地主機而不是服務器IP數據庫所在的位置。

0

試試這個

return [ 
     'class' => 'yii\db\Connection', 
     'dsn' => 'pgsql:host=localhost;dbname=db_name', 
     'username' => 'db_username', 
     'password' => NULL, 
     'charset' => 'utf8', 
     'schemaMap' => [ 
      'pgsql'=> [ 
      'class'=>'yii\db\pgsql\Schema', 
      'defaultSchema' => 'public' //specify your schema here 
      ] 
     ], // PostgreSQL 
    ]; 

或刪除password

相關問題