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
Why Intelligent Database Observability Is Essential for Enterprise AI and Machine Learning Workloads
- 30 July 2026
- Database Performance Management
Introduction Artificial intelligence (AI) and machine learning (ML) have moved from experimental initiatives to mission-critical enterprise capabilities. Organizations across banking, healthcare, retail, telecommunications, education, insurance, and SaaS industries are using AI-driven applications to automate decisions, personalize customer experiences, detect fraud, optimize operations, and generate business intelligence. However, successful AI adoption depends on more than sophisticated … Continue reading “Why Intelligent Database Observability Is Essential for Enterprise AI and Machine Learning Workloads”
How to Optimize Chemical Manufacturing with Enteros Database Software, Database Observability, and Predictive Analytics
Introduction The chemical manufacturing industry is one of the world’s most data-intensive and highly regulated sectors. Chemical producers must balance operational efficiency, production safety, environmental compliance, supply chain resilience, and profitability while managing complex manufacturing processes that operate continuously around the clock. Modern chemical manufacturers process millions of database transactions every day across production planning, … Continue reading “How to Optimize Chemical Manufacturing with Enteros Database Software, Database Observability, and Predictive Analytics”
How AI-Powered SQL Optimization Improves Database Efficiency Across Multi-Cloud Environments
Introduction Modern enterprises are rapidly adopting multi-cloud architectures to improve scalability, flexibility, resilience, and business agility. Organizations across banking, financial services, healthcare, retail, SaaS, telecommunications, and digital platforms are running mission-critical applications across multiple cloud providers, private infrastructure, and hybrid environments. However, as database ecosystems become more distributed, maintaining consistent performance becomes increasingly challenging. Applications … Continue reading “How AI-Powered SQL Optimization Improves Database Efficiency Across Multi-Cloud Environments”
How to Optimize Mining Operations with Enteros Database Software, AI-Powered Analytics, and Operational Intelligence
Introduction The mining industry is becoming increasingly digital, automated, and data-driven. Mining companies are investing heavily in smart mining technologies, Industrial Internet of Things (IIoT), autonomous vehicles, artificial intelligence (AI), predictive maintenance, cloud computing, and advanced analytics to improve operational efficiency, worker safety, environmental compliance, and profitability. Modern mining organizations operate large-scale open-pit mines, underground … Continue reading “How to Optimize Mining Operations with Enteros Database Software, AI-Powered Analytics, and Operational Intelligence”