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 ToProgrammingSoftwareTechnology

How to configure Apache Airflow on MacOS locally

4 Mins read
Table of contents0.1 Creating the project folder and the virtual environment0.2 Installing0.3 Running airflow0.4 Starting the webflow server0.5 Starting the scheduler0.6 Running…
Code ChallengesHow ToProgrammingSoftware

How To Implement Merge Sort and Quick Sort Algorithms In Python 3

3 Mins read
Table of contents0.1 Merge Sort0.2 Quick Sort0.3 Conclusion1 Don’t miss amazing tips! Let’s have a look at how to how to implement…
InterestingSoftwareTechnology

Getting started with TensorFlow, amazing basics

4 Mins read
Table of contents0.1 What is a Tensor?0.2 What is TensorFlow?0.3 How many models can I train with TensorFlow?0.4 How do I use…

Leave a Reply

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

87 − 82 =

×
Technology

What is a 3D printer, will it change the world?