Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

change the Database User Password

In this post, I am sharing basic commands to change the PostgreSQL database user password in Linux.

I would like to share this kind commands and scripts because this is very common and day to day exercise for a Database Administrator.

In the PostgreSQL, we have also one pg_hba.conf file.
pg_hba.conf is a configuration file which is controlled Client Authentication.
This file automatically installed when the data directory is initialized.

If you want to login without password, you can put “peer” or “trust” instead of md5 in this file.
local      all     postgres     peer 
But for the security purpose, we should put md5.

Change database password using ALTER:
First login:
sudo -u user_name psql database_name
ALTER Command:
ALTER USER user_name WITH PASSWORD 'MyNew_Password';
Change database password using \password:

First login:
root=# sudo -u user_name psql database_name
Using \password:
root=# \password user_name
Enter new password: ***
Enter it again: ***


Popular posts from this blog

PostgreSQL Database startup / shutdown /restart

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

2017 Shortern URL - Other Website Like ADFOC.US

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory

PostgreSQL Pgbadger Installation On Linux