简体   繁体   English

用户“root”、postgresSQL 和 docker 的密码验证失败

[英]password authentication failed for user "root", postgresSQL and docker

I'm trying to connect to my database using postgres on docker but it says that the password authentication failed.我正在尝试使用 docker 上的 postgres 连接到我的数据库,但它说密码身份验证失败。

My code:我的代码:

const { Client } = require('pg');

const client = new Client({
  host: 'localhost',
  port: 5432,
  user: 'root',
  password: 'root',
  database: 'mycontacts',
});

client.connect();

docker command to start the postgres container: docker 命令启动postgres容器:

docker run --name postg -e POSTGRES_USER=root2 -e POSTGRES_PASSWORD=root2 -p 5432:5432 -d postgres

Try creating another Postgres container to try and connect and it will work.尝试创建另一个 Postgres 容器来尝试连接,它会起作用。 Else.别的。 password authentication failed while trying to connect into my docker database 尝试连接到我的 docker 数据库时密码验证失败

It ended up being the postgres that i had installed on my pc.它最终成为我在我的电脑上安装的 postgres。

I uninstalled it and now its working!我卸载了它,现在它可以工作了!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Linux - NodeJS、Express、PostgreSQL - 错误处理程序:用户“root”的密码验证失败 - Linux - NodeJS, Express, PostgreSQL - ErrorHandler: password authentication failed for user "root" UnhandledPromiseRejectionWarning:错误:用户密码认证失败 - UnhandledPromiseRejectionWarning: error: password authentication failed for user 错误:用户“ myuser”的密码身份验证失败 - error: password authentication failed for user “myuser” 在javascript中散列密码以进行用户身份验证 - Hashing password in javascript for user authentication 在 Docker 中与 node/express 一起运行 PostgresSQL 的问题。 致命:启动数据包中未指定 PostgreSQL 用户名 - Problems with running PostgresSQL together with node/express in Docker. FATAL: no PostgreSQL user name specified in startup packet 使用javascript获取用户和密码身份验证(入门) - Getting user and password authentication with javascript (Beginner) postgres - windows docker 容器的密码验证失败 - postgres - password authentication fails from windows docker container Google身份验证:无法将用户序列化为会话 - Google authentication: failed to serialize user into session 错误:MongoError:身份验证失败。 我正在使用 docker 和 mongoose - error: MongoError: Authentication failed. I am using docker and mongoose MongoServerError:使用带有 docker 容器的 mongo 和 mongo express 时身份验证失败 - MongoServerError: Authentication failed when using mongo and mongo express with docker containers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM