我已经创建了一个用户user_1,但是如何连接postgres用户,而不是user_1呢?我不知道端口密码。
const {Pool} = require('pg');
const pool = new Pool({
user: 'user_1',
host: 'localhost',
database: 'info',
password: '1234',
port: 5432,
})发布于 2018-10-24 02:55:46
默认的PostgreSQL端口是5432。您可以检查连接和身份验证下的/etc/postgresql/9.6/main/postgresql.conf文件以找到端口。(用安装版本替换9.6 )
如果在创建用户时没有设置密码,则将密码字段保留为空。对于默认安装和默认用户,密码可能是postgres。
postgresql.conf
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
#listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)https://stackoverflow.com/questions/52957368
复制相似问题