无法在postgresql中访问超级用户
Can't access superuser in postgresql
我似乎无法访问我的 posgresQL 数据库的超级用户帐户。
使用命令:
psql -U postgres
我成功登录到用户 'postgres'。但是,这不是默认的超级用户。正在做:
=# \du
我得到:
List of roles
Role name | Attributes | Member of
-----------+-------------------------------------+-----------
pgsql | Superuser, Create DB | {}
postgres | Create role, Create DB, Replication | {}
所以 'pgsql' 似乎是我的默认超级用户。
尝试时:
psql -U pgsql
我收到以下错误:
psql: FATAL: database "pgsql" does not exist
我将 pg_hba.conf 文件更改为以下内容:
# Database administrative login by Unix domain socket
local all all trust
也尝试过:
# Database administrative login by Unix domain socket
local all pgsql trust
但我仍然得到同样的错误,数据库 'pgsql' 不存在。
非常感谢任何帮助,我需要能够访问数据库的超级用户。
只需定义数据库:
psql -U pgsql -d postgres
如果您收到 postgres 数据库不存在的错误,请使用 postgres 连接并使用 \l
列出数据库
我似乎无法访问我的 posgresQL 数据库的超级用户帐户。
使用命令:
psql -U postgres
我成功登录到用户 'postgres'。但是,这不是默认的超级用户。正在做:
=# \du
我得到:
List of roles
Role name | Attributes | Member of
-----------+-------------------------------------+-----------
pgsql | Superuser, Create DB | {}
postgres | Create role, Create DB, Replication | {}
所以 'pgsql' 似乎是我的默认超级用户。
尝试时:
psql -U pgsql
我收到以下错误:
psql: FATAL: database "pgsql" does not exist
我将 pg_hba.conf 文件更改为以下内容:
# Database administrative login by Unix domain socket
local all all trust
也尝试过:
# Database administrative login by Unix domain socket
local all pgsql trust
但我仍然得到同样的错误,数据库 'pgsql' 不存在。
非常感谢任何帮助,我需要能够访问数据库的超级用户。
只需定义数据库:
psql -U pgsql -d postgres
如果您收到 postgres 数据库不存在的错误,请使用 postgres 连接并使用 \l