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.

1
Related posts
How ToProgrammingSoftwareTechnology

How to configure Apache Airflow on MacOS locally

4 Mins read
Table of contents1 Creating the project folder and the virtual environment2 Installing3 Running airflow4 Starting the webflow server5 Starting the scheduler6 Running…
Code ChallengesHow ToProgrammingSoftware

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

3 Mins read
Let’s have a look at how to how to implement merge sort and quick sort algorithms in python 3. One of the…
InterestingSoftwareTechnology

Getting started with TensorFlow, amazing basics

4 Mins read
Table of contents1 What is a Tensor?2 What is TensorFlow?3 How many models can I train with TensorFlow?4 How do I use…

Leave a Reply

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

90 − = 80

×
ProgrammingSoftware

Can an average programmer create a simple AI?