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.

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
laughinl
  • 13
  • 1
  • 3

1 Answers1

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

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132