我正在构建一个Sails.js应用程序,并且我使用我的所有连接信息设置了sails-postgresql适配器,并且在我第一次提起应用程序并创建了所有表格时它工作正常。
现在我收到了这个错误:
error: A hook (`orm`) failed to load!
error: error: password authentication failed for user "postgres"
at Connection.parseE (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:540:11)
at Connection.parseMessage (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:367:17)
at Socket.<anonymous> (/root/royaltyPayer/vigilant-disco/royaltyPayer/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:535:20)
我已经尝试过发布到这个问题的所有答案:Postgresql: password authentication failed for user "postgres"
我确保用户postgres的linux密码和数据库密码是相同的。
以下是/etc/postgresql/9.4/main/pg_hba.conf中的相关行:
local all postgres peer
这是我在config / connections.js中的代码:
module.exports.connections = {
PostgresqlServer: {
adapter: 'sails-postgresql',
host: 'localhost',
user: 'postgres',
password: '12345',
port:'5433',
database: 'myDB'
}
这是我在config / models.js中的代码
module.exports.models = {
connection: 'PostgresqlServer',
migrate: 'safe'
}
我正在使用: Sails版本0.11.0, Postgres版本9.4, 节点版本6.0.0
我对psql中数据库的权限:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+----------+----------+-------------+-------------+----------------------------
myDB | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres