Skip to main content

Command Palette

Search for a command to run...

How to set a password for a user in Postgresql

Updated
1 min read
How to set a password for a user in Postgresql

Open a terminal


Connect to Postgresql

sudo -u postgres psql

postgres is the name of the user.


Change the password

ALTER USER postgres WITH PASSWORD 'postgres';

Output

'postgres' is the password.


Test the new password

psql -U postgres -h localhost

Output


Done


Celebrate

The It Crowd Birthday GIFs | Tenor


Reach me out


Final thoughts

Thank you for reading this article.

If you have any questions, thoughts, suggestions, or corrections, please share them with us.

We appreciate your feedback and look forward to hearing from you.

Feel free to suggest topics for future blog articles. Until next time!

More from this blog

Alexandre Calaça's Blog

265 posts

I'm a passionate software engineer with a deep love for turning complex problems into elegant solutions through code.