Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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:

ALTER ROLE username WITH LOGIN;

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

Related questions

0 votes
3 answers
asked Dec 31, 2020 in SQL by Appu (6.1k points)
0 votes
2 answers
0 votes
2 answers

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...