I’m setting up my PostgreSQL 9.1. I can’t do anything with PostgreSQL: can’t createdb, can’t createuser; all operations return the error message
Fatal: role h9uest does not exist
h9uest is my account name, and I sudo apt-get install PostgreSQL 9.1 under this account.
Similar error persists for the root account.
Use the operating system user
postgresto create your database – as long as you haven’t set up a database role with the necessary privileges that corresponds to your operating system user of the same name (h9uestin your case):As recommended here or here.
Then try again. Type
exitwhen done with operating as system userpostgres.Or execute the single command
createuseraspostgreswithsudo, like demonstrated bydsrees in another answer.
The point is to use the operating system user matching the database role of the same name to be granted access via
identauthentication.postgresis the default operating system user to have initialized the database cluster. The manual:I have heard of odd setups with non-standard user names or where the operating system user does not exist. You’d need to adapt your strategy there.
Read about database roles and client authentication in the manual.