psql: FATAL: "username" role not available

I am trying psql and getting an error.

$ psql
psql: FATAL: "myilmaz" role not available

Then I try

$ createdb python_getting_started
createdb: Unable to connect to template1 database: FATAL: "myilmaz" does not have access to the system

I run export DATABASE_URL=postgres://$(whoami) as indicated here and then started getting this error. I don't know if there was an error before that.

Note: I'm using Pardus 17.3, and it based Debian 9. 'myilmaz' is my username.

Edit: I tried adding my user to template1 in postgres user.

1 answer

  • answered 2018-10-11 19:09 Laurenz Albe

    These error messages do not appear in PostgreSQL; did you freely translate them from another language?

    Anyway, your problem is likely that psql and createdb assume a database user name identical to your current operating system user name, which is myilmaz.

    You can specify a database user name with the -U option.

    But it is probably better to login as operating system user postgres and then run the commands, this is typically how PostgreSQL installations are set up.