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
How to Achieve Intelligent Budgeting with Enteros Cloud Bill Analytics and AI SQL
- 15 May 2026
- Database Performance Management
Introduction As organizations continue accelerating digital transformation initiatives, cloud adoption has become essential for supporting scalability, agility, and innovation. Enterprises across industries now rely on cloud-native applications, distributed infrastructures, data analytics platforms, and AI-driven services to power modern operations. However, while cloud environments provide flexibility and scalability, they also introduce significant financial and operational complexity. … Continue reading “How to Achieve Intelligent Budgeting with Enteros Cloud Bill Analytics and AI SQL”
How to Improve Banking System Reliability with Enteros Database Software and AI SQL Analytics
Introduction The banking industry is experiencing rapid digital transformation driven by mobile banking, cloud-native platforms, real-time payment systems, and AI-powered financial services. Customers now expect seamless digital experiences, instant transactions, and uninterrupted banking services across every channel. As banks modernize their operations, maintaining system reliability has become more critical than ever. A single outage, slow … Continue reading “How to Improve Banking System Reliability with Enteros Database Software and AI SQL Analytics”
Enhancing Database Performance and Scalability in Digital Banking Platforms with Advanced Analytics
- 14 May 2026
- Database Performance Management
Introduction Digital banking has transformed the financial services landscape. Customers now expect seamless mobile banking experiences, instant payments, real-time transaction confirmations, and 24/7 service availability. These modern banking services rely heavily on high-performance database infrastructures that support massive transaction volumes and complex analytics workloads. At the core of every digital banking interaction—whether it is a … Continue reading “Enhancing Database Performance and Scalability in Digital Banking Platforms with Advanced Analytics”
How Intelligent Database Analytics Improves Performance and Reliability in Modern E-Learning Platforms
Introduction The global shift toward digital education has transformed how institutions deliver learning experiences. Universities, online learning platforms, corporate training systems, and educational technology companies now rely heavily on digital platforms to deliver courses, manage learning data, and support millions of simultaneous users. Behind every online lecture, virtual classroom, exam submission, and learning analytics dashboard … Continue reading “How Intelligent Database Analytics Improves Performance and Reliability in Modern E-Learning Platforms”