1

I can't seem to access my superuser account for my posgresQL database.

Using the command:

psql -U postgres

I sucessfully login into the user 'postgres'. However, this is not the default superuser. Doing:

=# \du

I get:

List of roles
 Role name |             Attributes              | Member of 
-----------+-------------------------------------+-----------
pgsql     | Superuser, Create DB                | {}
postgres  | Create role, Create DB, Replication | {}

So 'pgsql' appears to be my default superuser.

When trying:

psql -U pgsql

I get the following error:

psql: FATAL:  database "pgsql" does not exist

I changed the pg_hba.conf file to the following:

# Database administrative login by Unix domain socket
local   all             all                                trust

and also tried:

# Database administrative login by Unix domain socket
local   all             pgsql                                trust

but I still get the same error regardless, that database 'pgsql' does not exist.

Any help would be greatly appreciated, I need to be able to access the database's superuser.

1 Answer 1

1

just define database:

psql -U pgsql -d postgres

if you get error that postgres database does not exist, connect as postgres and list databases with \l

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.