Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

PostgreSQL Drop User Using Utility

dropuser removes an existing PostgreSQL user and the databases which that user owned. Only superusers (users with usesuper set in the pg_shadow table) can destroy PostgreSQL users.
Syntax:
dropuser [option...] [username]
Options Are:
Options
EXPLANATION
username
Specifies the name of the PostgreSQL user to be removed. You will be prompted for a name if none is specified on the command line.
-e
--echo
Echo the commands that dropuser generates and sends to the server.
-i
--interactive
Prompt for confirmation before actually removing the user.
-q
--quiet
Do not display a response.
-h host
--host host
Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket.
-p port
--port port
Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.
-U username
--username username
User name to connect as (not the user name to drop)
-W
--password
Force password prompt (to connect to the server, not for the password of the user to be dropped).

db2=> \du            
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
gp1 | Cannot login | {}
nijam | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
rep | Replication +| {}
| 1 connection |
u3 | Password valid until 2017-06-06 00:00:00-04 | {}
u6 | | {}
u8 | Superuser, Create role, Create DB | {}
u9 | | {}

--Now give the super user password
-bash-3.2$ cd /opt/PostgreSQL/9.3/bin/
-bash-3.2$ ./dropuser u6
Password:
--List the user u6 will be deleted
db2=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
gp1 | Cannot login | {}
nijam | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
rep | Replication +| {}
| 1 connection |
u3 | Password valid until 2017-06-06 00:00:00-04 | {}
u8 | Superuser, Create role, Create DB | {}
u9 | | {}
 --To remove user  u3 using the server on host p1, port 5432, with verification and a peek at the underlying command:
-bash-3.2$ ./dropuser -p 5432 -h p1 -i -e u3  -U postgres 
Role "u3" will be permanently removed.
Are you sure? (y/n) y
Password:
DROP ROLE u3;
db2=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
gp1 | Cannot login | {}
nijam | | {}
postgres | Superuser, Create role, Create DB, Replication | {}
rep | Replication +| {}
| 1 connection |
u8 | Superuser, Create role, Create DB | {}
u9 |


Comments

Popular posts from this blog

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

Oracle to Postgresql migration

PostgreSQL Enterprise Manager - PEM Monitoring Tools

7 Steps to configure BDR replication in postgresql