DBA Hub

📋Steps in this guide1/1

Alter an user in postgres

-- Rename a user:

postgresql configurationintermediate
by PostgreSQL
11 views
1

Alter an user in postgres

-- Rename a user: i.e -- Change the password a user: --- Increase the validity of the user:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
postgres=#
alter user dbatest rename to dbaprod;
NOTICE: MD5 password cleared because of role rename
ALTER ROLE
postgres=#
\du
List of roles
Role name  | Attributes                                                 | Member of
-----------+------------------------------------------------------------+-----------
dbaprod   |                                                             | {}
postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS  | {}
<< NOTE - AFTER renaming the user, you need to reset the password to same old one.
postgres=#
alter user dbaprod password 'test';
ALTER ROLE
postgres=#
alter user dbaprod valid until 'Feb 10 2021';
ALTER ROLE

Comments (0)

Please to add comments

No comments yet. Be the first to comment!