1
How ToSoftware

Make Postgres User a Superuser in Linux

1 Mins read

How can you make postgres user a superuser in Linux? Assuming you have a situation where you need to make PostgreSQL “Superuser” in Linux, you can do so by running the following commands: I recently came across this issue and this is the solution that worked for me.

Use single mode

a) As root user – stop postgres service by running

service postgresql stop

b) Change the system user to a non root user such as postgres by running

su postgres

c) Access single user mode by running the following(Change the postgres folder installation location based on your postgresql version)

/usr/lib/postgresql/10/bin/postgres --single -D /etc/postgresql/10/main/

d) Run the alter command

ALTER user postgres with SUPERUSER;

e) Start your postgres server

service postgresql restart

e) Confirm changes by getting onto postgres terminal and typing the following.

\du;

As you can see, postgres is now a superuser – you can do this for any other user you wish

Conclusion

These steps should work for most postgresql installations in 2.6, 2.8 and 9

For earlier versions I would suggest running the commands to start single mode, stop postgres and re-start as a non root user.

Read an interesting article on creating a simple AI as a programmer.

Don’t miss amazing tips!

1
Related posts
How ToProgrammingSoftware

How to link flutter with firebase email password authentication

11 Mins read
Table of contents0.1 firebase email password authentication output flow0.2 Creating our email password authentication on flutter0.3 Step 10.4 Setting up firebase and…
How To

How To Implement Data Tables In Cucumber Using Selenium Ruby

17 Mins read
Table of contents0.1 Advantages of Behavior Driven Development0.2 What is Cucumber?0.3 What are data tables in Cucumber?0.4 How to implement data tables…
How ToProgrammingSoftware

How To Write Clean Code

3 Mins read
Let’s look at tips and tricks on how to write clean code. Everyone wants to be able to write code that is…

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + = 16

×
ProgrammingSoftware

Can an average programmer create a simple AI?