无法使用 'pg' gem 连接到 postgres?
Can't connect to postgres with 'pg' gem?
我在尝试测试与 postgres 的连接时使用以下代码:
require 'pg'
conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetbdb")
res = conn.exec('select tablename, tableowner from pg_tables')
我找回了错误:
test.rb:3:in initialize': FATAL: password authentication failed for
user "puppetdb" (PG::ConnectionBad) from test.rb:3:in
new' from
test.rb:3:in `'
但我有一个 python 脚本,它具有相同的凭据,似乎运行良好:
import psycopg2
try:
conn = psycopg2.connect("dbname='puppetdb' user='puppetdb' host='localhost' port='5432' password='puppetdb'")
鉴于 python 脚本,我想知道我是否输入了错误的凭据?
您的密码有误 (puppetbdb
):
conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetdb")
我在尝试测试与 postgres 的连接时使用以下代码:
require 'pg'
conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetbdb")
res = conn.exec('select tablename, tableowner from pg_tables')
我找回了错误:
test.rb:3:in
initialize': FATAL: password authentication failed for user "puppetdb" (PG::ConnectionBad) from test.rb:3:in
new' from test.rb:3:in `'
但我有一个 python 脚本,它具有相同的凭据,似乎运行良好:
import psycopg2
try:
conn = psycopg2.connect("dbname='puppetdb' user='puppetdb' host='localhost' port='5432' password='puppetdb'")
鉴于 python 脚本,我想知道我是否输入了错误的凭据?
您的密码有误 (puppetbdb
):
conn = PGconn.connect("localhost", 5432, '', '', "puppetdb", "puppetdb", "puppetdb")