Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (6.1k points)
edited by

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 the account name I use. I sudo apt-get install PostgreSQL 9.1 under this account.

Similar error persists for the root account.

1 Answer

0 votes
by (12.7k points)

sudo su - postgres

psql template1

create a role in pgsql with privilege as "superuser":

CREATE ROLE username superuser;

eg. CREATE ROLE demo superuser;

Then create a user:

CREATE USER username; 

eg. CREATE USER demo;

Assign privilege to the user:

GRANT ROOT TO username;

And then enable login to that user, so that you can run e.g.: psql template1, from normal $ terminal:


Interested in SQL ? Check out this SQL Certification by Intellipaat.

Browse Categories