Node.js Knex:Error Pool2-错误:用户的密码身份验证失败;用户名";(不使用UNIX帐户)

Node.js Knex:Error Pool2-错误:用户的密码身份验证失败;用户名";(不使用UNIX帐户),node.js,postgresql,pg,knex.js,Node.js,Postgresql,Pg,Knex.js,以下命令出现问题: knex--knexfile config/db/knexfile.js migrate:latest 我得到以下错误: Knex:warning - Pool2 - Error: Pool was destroyed Knex:Error Pool2 - error: password authentication failed for user "dennis" Knex:Error Pool2 - error: password authentication faile

以下命令出现问题:

knex--knexfile config/db/knexfile.js migrate:latest

我得到以下错误:

Knex:warning - Pool2 - Error: Pool was destroyed
Knex:Error Pool2 - error: password authentication failed for user "dennis"
Knex:Error Pool2 - error: password authentication failed for user "dennis"
Error: Pool was destroyed
    at Pool._destroyPool (/home/dennis/projects/amgen-sites/data-api/node_modules/pool2/lib/pool.js:560:20)
    at Pool.<anonymous> (/home/dennis/projects/amgen-sites/data-api/node_modules/pool2/lib/pool.js:474:18)
    at Pool.<anonymous> (/home/dennis/projects/amgen-sites/data-api/node_modules/pool2/lib/pool.js:517:17)
    at tryCatcher (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.errorAdapter [as _rejectionHandler0] (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/nodeify.js:35:34)
    at Promise._settlePromise (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/promise.js:558:21)
    at Promise._settlePromise0 (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/promise.js:606:10)
    at Promise._settlePromises (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/promise.js:681:18)
    at Async._drainQueue (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues (/home/dennis/projects/amgen-sites/data-api/node_modules/knex/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:570:20)
    at tryOnImmediate (timers.js:550:5)
    at processImmediate [as _immediateCallback] (timers.js:529:5)
如何让它使用我的UNIX帐户

我在Ubuntu 16.04上使用NodeV6.3.1

以下是我安装的软件包:

├── bluebird@2.10.2
├── body-parser@1.15.2
├── bookshelf@0.10.0
├── chai@3.5.0
├── chai-as-promised@5.3.0
├── colors@1.1.2
├── convict@1.4.0
├── cors@2.7.1
├── express@4.14.0
├── gulp@4.0.0-alpha.2 (git://github.com/gulpjs/gulp.git#d8f5c90a0622d19ef1943a2a3d02dc50e3c853e7)
├── gulp-exit@0.0.2
├── gulp-mocha@2.2.0
├── gulp-nodemon@2.1.0
├── gulp-using@0.1.0
├── jsonwebtoken@5.7.0
├── knex@0.11.10
├── lodash@3.10.1
├── pg@6.1.0
├── request-promise@0.4.3
├── sinon@1.17.5
├── sinon-as-promised@4.0.2
├── sinon-chai@2.8.0
├── supertest@1.2.0
└── validator@4.9.0

结果表明,将方法从
md5
重命名为
trust
是正确的解决方案。在进行更改后,我忘记重新启动postgresql服务,因此它第一次无法工作。

结果表明,将方法从
md5
重命名为
trust
是正确的解决方案。在进行更改后,我忘记重新启动postgresql服务,因此它第一次没有工作。

您好,AFAIK knex只是将配置对象传递给pg库:如果是,则由pg提供某种方法来使用unix套接字而不是tcp连接。@Sombriks您是对的,这是postgresql配置问题。您好,AFAIK knex只是将config对象传递给pg库:如果是这样,则由pg提供使用unix套接字而不是tcp连接的方法。@Sombriks您是对的,这是postgresql配置问题。
├── bluebird@2.10.2
├── body-parser@1.15.2
├── bookshelf@0.10.0
├── chai@3.5.0
├── chai-as-promised@5.3.0
├── colors@1.1.2
├── convict@1.4.0
├── cors@2.7.1
├── express@4.14.0
├── gulp@4.0.0-alpha.2 (git://github.com/gulpjs/gulp.git#d8f5c90a0622d19ef1943a2a3d02dc50e3c853e7)
├── gulp-exit@0.0.2
├── gulp-mocha@2.2.0
├── gulp-nodemon@2.1.0
├── gulp-using@0.1.0
├── jsonwebtoken@5.7.0
├── knex@0.11.10
├── lodash@3.10.1
├── pg@6.1.0
├── request-promise@0.4.3
├── sinon@1.17.5
├── sinon-as-promised@4.0.2
├── sinon-chai@2.8.0
├── supertest@1.2.0
└── validator@4.9.0