Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: must be superuser to alter superusers

Unfortunately, I have removed super user privileges from postgres user in PostgreSQL. And currently I have not any super user in PostgreSQL. And i want to make superuser. So how can i make it ? Every time I am trying to make postgres to super user. I am facing this problem.

Error : must be superuser to alter superusers.

Thanks in advance,

like image 949
user3094370 Avatar asked Jan 08 '14 11:01

user3094370


People also ask

How do I give superuser permissions in PostgreSQL?

Log into PostgreSQL and run the following ALTER USER command to change user test_user to superuser. Replace test_user with username as per your requirement. postgres-# ALTER USER test_user WITH SUPERUSER; In the above command, we use WITH SUPERUSER clause to change user to superuser.

What is superuser in PostgreSQL?

A superuser in PostgreSQL is a user who bypasses all permission checks. Superusers can run commands that can destabilize or crash the database server (e.g., create C functions) and access the operating system.

Where is super user in PostgreSQL?

PostgreSQL: Find Users in PostgreSQL Answer: In PostgreSQL, there is a system table called pg_user. You can run a query against this system table that returns all of the Users that have been created in PostgreSQL as well as information about these Users.

How do I change the current user in PostgreSQL?

Another option, if you're already connected to database seturl , is the command: SET ROLE shorturl; The benefits of that command are that it's not tied to psql, and that you can change user "midstream" of your work.

How to change single user to superuser in PostgreSQL?

You have two choices. 2: start your db in single user mode. superuser, then issue the command postgres --single. From there you can then set a user back to being a superuser.

How to give superuser rights to another user?

backend> ALTER USER "yourname" with superuser; or whatever privilege you need to fix You're going to have to stop the database system and start a stand-alone back-end, which always unconditionally runs as a superuser. You can use this backend to ALTER the user you wish to give superuser rights to.

How to make myself a superuser?

How to make myself a superuser? You cannot create superuser, refer this official document. Since this service is a managed PaaS service, only Microsoft is part of the super user role. You cannot create superuser, as we are given only an admin user when we create the PG server resource.

How to create Superuser for PG Server Resource?

You cannot create superuser, refer this official document. Since this service is a managed PaaS service, only Microsoft is part of the super user role. You cannot create superuser, as we are given only an admin user when we create the PG server resource. See official document.


2 Answers

(assuming you have root access on Ubuntu machine)

To enter psql as super user you need to:

sudo -u postgres psql

as suggested in this SO post here

If there is no user called postgres you need to create it on system first, with:

sudo adduser newuser

Else, if you have problems with password not accepted or not created at all you can follow (Ubuntu 14.04 related) instructions here or for more on user accounts look here

like image 55
Zalom Avatar answered Sep 18 '22 01:09

Zalom


For me helps:

sudo -u gleb psql postgres

where gleb is my mac system user

like image 39
Gleb Dolzikov Avatar answered Sep 20 '22 01:09

Gleb Dolzikov