Problem scenario
From a SQL front end you are connected to a Postgres database as user jdoe. You try to create a database with the "create database verycool" SQL command. You get this message: "ERROR: permission denied to create database."
You try to enter the database from the back end, but you get 'psql: FATAL: role "root" does not exist.' Or you may even get the error "psql: FATAL: Peer authentication failed for user" when trying to connect or log into Postgres. What do you do with these errors?
Solution
From the Linux back end, run these four commands:
# sudo -u postgres -i
# psql
# alter role jdoe createdb;
# \q
Now the jdoe user should be able to create a database.