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 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…
How To

Is The Universe Infinite or Finite

3 Mins read
Table of contents0.1 What is cosmic inflation?0.2 How is space measured?0.3 Conclusion1 Don’t miss amazing tips! Is the Universe infinite or finite….
How To

Extremely Simple Ways To Celebrate Small Wins At Home

2 Mins read
This is a post about how the ways to celebrate small wins. These are not major achievements like graduating college, buying a…

Leave a Reply

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

2 + 2 =

×
Technology

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