password authentication failed for user
password authentication failed for user “postgres” with docker
步骤
- 运行指令创建一个docker容器
docker run --rm --name test-postgres -p 5432:5432 -e POSTGRES_PASSWORD=pw -d postgres
- 在node code里运行下面指令连接数据库
import pg from 'pg' const { Pool } = pg pool = new Pool({database: 'postgres',user: 'postgres',password: 'pw',port: 5432 })
抛出下面错误
error: password authentication failed for user “postgres”
原因分析
因为本地已安装过postgres,postgres默认在启动系统时自动启动。在连接数据库时,优先连接本地安装的postgres service,所以连接失败。
解决步骤
打开window任务管理器, 在Services下面看到有一个postgres service在运行。右击关掉postgres service,打开Service窗口后,双击postgres service把Startup Type设成Manual。
然后
其他排查方法
打开容器的Terminal
- 输入下面两个指令,查看是不是local host权限有问题:
cd var/lib/postgresql/data
cat pg_hba.conf
- 查看默认用户是不是postgres:
psql -U postgres -x -c "select * from current_user;"
- 查看密码有效期。rolvaliduntil没值说明无有限期限制。
psql -h 127.0.0.1 -U postgres -d postgres
SELECT * FROM pg_roles WHERE rolname='postgres';
- 试一试清一下docker的volumns以及containers,然后重新起一下docker
password authentication failed for user相关推荐
- SSH远程登录失败,提示“Password authentication failed”
使用SecureCRT登陆,提示"Password authentication failed" 使用linux下ssh登陆,提示"Permission denied, ...
- zabbix server报错:FATAL: password authentication failed for user zabbix
zabbix agent日志 [root@localhost zabbix]# cat zabbix_server.log FATAL: password authentication failed ...
- FATAL: password authentication failed for user postgres
FATAL: password authentication failed for user "postgres" 致命:用户"postgres"的密码验证失败 ...
- SecureCRT出现Password authentication failed,也可能是用户名错误
第一次写博,记载一下碰到的错误 使用SecureCRT登录虚拟机,发现出现"Password authentication failed" 在网上找了一堆方法,都试了一下,发现都没 ...
- SecureCRT通过SSH服务登录ubuntu出错:Password authentication failed, Please verify that the username and passw
1. 首先确保ubuntu安装ssh服务.通过ps -e | grep ssh查看,如果 sshd表示ssh已成功启动. 2. 通过SecureCRT登录ssh服务 提示错误:Password aut ...
- 数据库工具连接Mysql报Password authentication failed错误
最近项目需要用mysql数据库,同事把一个新安装的数据交给我使用,没想到一步一个坑,在此记录一下遇到的这个问题. 问题描述 使用navicat数据库工具连接mysql时,弹出了"Passwo ...
- PostgreSQL安装遇到的坑:Problem running post-install step/password authentication failed for user postgres
第一个问题: 安装过程中提示:Problem running post-install step. Installation may not complete correctly. The datab ...
- 无法建立SSH链接和Password Authentication Failed,Please verify that the username and password are correct解决
因为我的Ubuntu中未安装ssh服务,终端下运行命令: sudo apt-get install openssh-server 之后重启一下ssh服务: sudo service sshd re ...
- 接数句库时 出现FATAL: password authentication failed for user ****
连接postgresql数据库时,使用的是本机的实际地址.连接是出现:password authentication failed for user "****". 原因应该是po ...
最新文章
- python 中cookie_Python 处理Cookie的菜鸟教程(一)Cookie库
- UV认证应用安全标准的目的
- mysql中查询一个字段属于哪一个数据库中的哪一个表的方式
- Go-json解码到接口及根据键获取值
- 打开eclipse出现JVM terminated.Exit Code=-1错误的解决办法
- [坐标]关于坐标系和投影的相关知识探讨[转]
- (二)深入了解超文本
- 蚌埠学院官网综合新闻条目抓取
- css sprite原理优缺点及使用
- Spring之AOP(面向切面编程)_入门Demo
- CyclicBarrier(栅栏)实现高并发测试
- [Redis]Redis客户端
- mysql pdo连接不上_通过PDO连不上数据库
- 用c语言实现下载文件
- 【环境】NVIDIA驱动安装+cuda11.0(ubuntu16.04)
- 注册公司的步骤及费用
- python 网络培训班费用具体是多少?
- 网易发布第四季度财报 营收28.9亿美元
- html5中加入音乐怎么弄,如何在H5页面上添加音乐播放
- 基于粒子群算法与最小二乘拟合函数参数