Creating a PostgreSQL db

Suvayu Ali fatkasuvayu+linux at gmail.com
Wed Mar 9 18:18:32 UTC 2016


Hi,

I want to create a PostgreSQL db.  So I did the following:

  $ su -
  # su - postgres
  $ pg_ctl initdb -D /var/lib/pgsql/data
  $ exit
  # systemctl start postgresql
  # exit
  $ createdb mydb
  createdb: could not connect to database template1: FATAL:  role "user" does not exist

I don't understand this since /var/lib/pgsql/data/pg_hba.conf has these
lines:

  # TYPE  DATABASE        USER            ADDRESS                 METHOD
  local   all             all                                     trust
  host    all             all             127.0.0.1/32            trust
  host    all             all             ::1/128                 trust

Shouldn't the local line take care of my permissions?  What am I doing wrong?

TIA,

-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list