我安装了PostgreSQL 8.4,Postgres客户端和Pgadmin 3.对于控制台客户端和Pgadmin用户"postgres"的身份验证失败.我输入的用户为"postgres",密码为"postgres",因为之前有效.但现在身份验证失败了.我之前做过几次没有这个问题.我该怎么办?会发生什么?
psql -U postgres -h localhost -W
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
Run Code Online (Sandbox Code Playgroud) 我在我的Ubuntu Karmic盒子上安装了PostgreSQL和pgAdminIII.
我能够成功使用pgAdminIII(即连接/登录),但是当我尝试使用命令行上的相同用户名/ pwd登录服务器时(使用psql),我收到错误:
psql: FATAL: Ident authentication failed for user "postgres"
Run Code Online (Sandbox Code Playgroud)
现在有人如何解决这个问题?
我在Ubuntu 11.10和RubyMine上运行我的开发
这是我对database.yml的开发设置:RubyMine为我创建的
development:
adapter: postgresql
encoding: unicode
database: mydb_development
pool: 5
username: myuser
password:
Run Code Online (Sandbox Code Playgroud)
当我尝试运行应用程序时,我在下面收到此错误,似乎我还没有创建"项目"用户,但是,我如何创建用户并在postgres中为其授予数据库?如果这是问题,那么,在Ubuntu中为此任务使用的推荐工具是什么?如果这不是问题,那么,请指教.
Exiting
/home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194:in `initialize': FATAL: Peer authentication failed for user "project" (PG::Error)
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194:in `new'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194:in `connect'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:303:in `new_connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:313:in `checkout_new_connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:237:in `block (2 levels) in checkout'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:232:in `loop'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:232:in `block in checkout'
from /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `retrieve_connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
from /home/sam/.rvm/gems/ruby-1.9.3-p0@project/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in …Run Code Online (Sandbox Code Playgroud) 我最近安装了 Postgresql 11,在安装过程中,没有步骤为 Postgres 输入密码和用户名。现在在 pgAdmin 4 中,我想将数据库连接到服务器,它要求我输入密码,而我一开始没有输入密码。任何人都知道发生了什么。谢谢!
我是Postgres和Heroku的新手.我试图从Heroku中提取数据库,但我遗漏了一些简单的东西.我做了:
heroku pg:pull HEROKU_POSTGRESQL_IVORY_URL localdb
Run Code Online (Sandbox Code Playgroud)
我收到了错误:
createdb: database creation failed: ERROR: permission denied to create database
Run Code Online (Sandbox Code Playgroud)
然后我尝试了同样的"sudo".我得到了:
createdb: could not connect to database template1: FATAL: role "root" does not exist
Run Code Online (Sandbox Code Playgroud)
所以,我必须缺少一些我找不到的简单命令.我在Linux上,我安装了Postgres并正在工作.
如果我说,Postgres不接受连接,-h localhost但如果我说,它可以工作-h 127.0.0.1
[root@5d9ca0effd7f opensips]# psql -U postgres -h localhost -W
Password for user postgres:
psql: FATAL: Ident authentication failed for user "postgres"
[root@5d9ca0effd7f opensips]# psql -U postgres -h 127.0.0.1 -W
Password for user postgres:
psql (8.4.20)
Type "help" for help.
postgres=#
Run Code Online (Sandbox Code Playgroud)
我的 /var/lib/pgsql/data/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host …Run Code Online (Sandbox Code Playgroud) 您如何配置 PostgreSQL 以允许默认的 postgres 用户在没有来自 localhost 的密码的情况下登录?
有几个类似的问题,例如this和this,但没有一个修改建议pg_hba.conf对我有用。但是,根据我对pg_hba.conf规则的理解,我应该能够使用peer或trust选项来完成此操作。
我正在尝试运行如下命令:
sudo psql --user=postgres --no-password --command="blah;" -h 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
如果我在我的pg_hba.conf:
local all postgres trust
Run Code Online (Sandbox Code Playgroud)
我的命令失败并出现错误:
psql: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL off
Run Code Online (Sandbox Code Playgroud)
如果我试过这条线:
local all postgres peer
Run Code Online (Sandbox Code Playgroud)
我的命令失败并出现相同的错误。
我该如何解决?
我在Ruby On Rails中有一个带有postgresql数据库的简单网页,但是当我运行服务器时我有这个错误,我不知道我这样做.我使用postgresql,因为heroku需要aplication在postgresql中.
我在ubuntu 13.10工作
错误是:
PG :: ConnectionBad无法连接到服务器:没有这样的文件或目录服务器是否在本地运行并接受Unix域套接字"/var/run/postgresql/.s.PGSQL.5432"上的连接?
我需要帮助
谢谢
我目前正在为一个学校项目创建一个 API,一切正常。我的设置是:Node v10、Postgres、Koa 等等...
我目前有这个:
CREATE ROLE sa WITH LOGIN PASSWORD 'some-password.';
CREATE DATABASE master WITH OWNER sa;
\c master;
Run Code Online (Sandbox Code Playgroud)
当 init 脚本在 docker 机器中运行时,我得到的输出是这样的:
CREATE ROLE
CREATE DATABASE
You are now connected to database "master" as user "postgres".
Run Code Online (Sandbox Code Playgroud)
所以我确实将文件更改为这样的:
CREATE ROLE sa WITH LOGIN PASSWORD 'some-password.';
CREATE DATABASE master WITH OWNER sa;
CONNECT TO master AS main USER sa;
Run Code Online (Sandbox Code Playgroud)
我收到一个语法错误:
STATEMENT: CONNECT TO master AS sa USER sa;
psql:/docker-entrypoint-initdb.d/init.sql:4: ERROR: syntax error at or near "CONNECT"
Run Code Online (Sandbox Code Playgroud)
我在文档中找不到任何地方(或者看起来不太好)如何从 .sql 文件连接到具有特定用户的数据库。 …
如何从管理员访问 postgres 数据库?
我已经更改了用户的密码postgres:
$ sudo -u postgres psql
$ postgres=# alter user postgres password 'secret';
Run Code Online (Sandbox Code Playgroud)
结果:
ALTER ROLE
Run Code Online (Sandbox Code Playgroud)
但是我仍然在管理员上收到此错误:
Unable to connect to PostgreSQL server: FATAL: Peer authentication failed for user "postgres"
Run Code Online (Sandbox Code Playgroud)
任何想法为什么?
我有这两个用户:
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
root | Superuser, Create role, Create DB | {}
Run Code Online (Sandbox Code Playgroud)
但是root当我使用以下命令创建用户时,我没有为用户设置密码:
sudo -u postgres createuser …Run Code Online (Sandbox Code Playgroud) 我做了什么:
sudo -u postgres psql
CREATE ROLE shop CREATEDB LOGIN PASSWORD 'kurt1245';
Run Code Online (Sandbox Code Playgroud)
然后我从GitHub克隆了一个存储库(一个使用pg的rails应用程序)bundle install,编辑database.yml来编写我的密码,现在在rake db:create(也setup和migrate)之后不起作用.
database.yml:
development:
adapter: postgresql
encoding: unicode
database: shop_development
pool: 5
username: shop
password: kurt1245
test:
adapter: postgresql
encoding: unicode
database: shop_test
pool: 5
username: shop
password: kurt1245
postgresql ×11
heroku ×2
adminer ×1
connection ×1
linux ×1
pgadmin ×1
pgadmin-4 ×1
ruby ×1
sql ×1
ubuntu ×1
ubuntu-11.10 ×1