Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 August PostgreSQL: How to change the Database User Password in Linux

PostgreSQL: How to change the Database User Password in Linux

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

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.
like,

1
local all postgres peer

But for the security purpose, we should put md5.

Change database password using ALTER:

First login:

1
sudo -u user_name psql database_name

ALTER Command:

1
ALTER USER user_name WITH PASSWORD 'MyNew_Password';

Change database password using \password:

First login:

1
root=# sudo -u user_name psql database_name

Using \password:

1
2
3
4
root=# \password user_name
 
Enter new password: ***
Enter it again: ***

Aug 8, 2016Anvesh Patel

Please visit other related articles...

  • PostgreSQL psql FATAL: error Peer authentication failed for user
  • PostgreSQL: pg_ident.conf to map Operating System Username and Database Username
  • PostgreSQL: Why psql is running without Password?
  • PostgreSQL: How to Delete all duplicate rows Except one
  • PostgreSQL: Create Index on Full Text Search tsvector Data
  • PostgreSQL: Example of SERIALIZABLE Isolation Level
  • PostgreSQL: Disable Non-Durable parameters and Improve Server Performance
  • PostgreSQL: How to remove accents (diacritic signs) from lexemes
PostgreSQL: Script to find all Default Values of the ColumnsPostgreSQL: The Internal path of a Query Execution to Obtain a Result
Anvesh Patel

Database Engineer

August 8, 2016 PostgreSQL, PostgreSQL DBA ScriptAnvesh Patel, database, database research and development, dbrnd, Password, plpgsql, Postgres Query, postgresql, PostgreSQL Administrator, PostgreSQL Error, PostgreSQL Programming, PostgreSQL Tips and Tricks
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....