Preamble
A PostgreSQL database’s user password can change using the ALTER USER operator.
The syntax for changing the password with ALTER USER statement in PostgreSQL
ALTER USER user_name
WITH [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'new_password'
| VALID UNTIL 'expiration';
Parameters and arguments of the statement
- user_name – User whose password you want to change.
- new_password – The user will give a new password.
- expiration – date/time when the password expires. If you do not want your password to expire, set it to ‘infinity’.
Example of using an ALTER USER operator
Consider an example that shows how to use the ALTER USER operator in PostgreSQL to change the password.
For example, if you want to update a user with the Zorg username and password zub*a*stik, you must execute the following ALTER USER operator in PostgreSQL:
ALTER USER zorg
WITH PASSWORD 'zub*a*stik';
If you want to set a password for user Zorg, which expires on January 1, 2020, use the ALTER USER operator as follows:
ALTER USER zorg
VALID UNTIL 'Jan 1, 2020';
If you want the password for a trizor user never to expire, you must use the ALTER USER operator as follows:
ALTER USER trizor
VALID UNTIL 'infinity';
PostgreSQL Change PostgreSQL password
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Driving Retail Growth Performance with Spot Instances and Generative AI—Powered by Enteros
- 1 October 2025
- Database Performance Management
Introduction The retail industry is at the epicenter of digital transformation. With the rise of e-commerce, omnichannel experiences, personalization, and AI-driven customer engagement, retailers are generating and managing enormous volumes of data. Every transaction, customer interaction, supply chain movement, and marketing campaign depends on the performance of retail databases and cloud infrastructure. At the same … Continue reading “Driving Retail Growth Performance with Spot Instances and Generative AI—Powered by Enteros”
Unlocking Financial Sector Resilience with AI-Powered Performance Management and Root Cause Analysis—Driven by Enteros
Introduction The financial sector is one of the most data-intensive industries in the world. From real-time transaction processing and fraud detection to compliance reporting and customer relationship management, banks and financial institutions depend heavily on high-performance databases and IT systems. Downtime, inefficiencies, or poor performance are not just technical issues—they directly translate into lost revenue, … Continue reading “Unlocking Financial Sector Resilience with AI-Powered Performance Management and Root Cause Analysis—Driven by Enteros”
Case Study: How a Manufacturing Firm Saved $3M in 12 Months Through Smarter Database Optimization
- 30 September 2025
- Software Engineering
Background A global manufacturing company operating multiple factories across North America relied heavily on SAP ERP, Oracle Database, and IoT-driven digital twins to manage production. With thousands of sensors feeding real-time data into their systems, every query delay directly impacted robotics alignment, predictive maintenance, and overall production output. By 2023, IT costs had escalated. Cloud … Continue reading “Case Study: How a Manufacturing Firm Saved $3M in 12 Months Through Smarter Database Optimization”
Revolutionizing Healthcare IT with Smarter Database Performance Management, AI SQL, and AIOps—Powered by Enteros
Introduction The healthcare industry is in the midst of a digital transformation, driven by the need for faster diagnostics, improved patient outcomes, and more efficient clinical workflows. From electronic health records (EHRs) and telemedicine platforms to AI-powered medical imaging and predictive analytics for disease prevention, healthcare organizations rely heavily on data. At the core of … Continue reading “Revolutionizing Healthcare IT with Smarter Database Performance Management, AI SQL, and AIOps—Powered by Enteros”