How to create user in postgres – postgres tutorials

Create user in postgrescreate user in postgres

In this tutorial, I will show you how to create user in postgres command line.

PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It is fully ACID compliant, has full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It includes most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation.

Read Also: How to install postgresql 9.6 on centos 7
Read Also: Install postgres  on mac using postgres app
How to install postgresql 9.6 on Ubuntu

Create user in Postgres

I will show you how to create a user in Postgres through the command line.

postgres=# CREATE USER installvirtual;

Read Also: How to check number of rows in postgres table

Permissions in Postgres

Give permission to user in Postgres.

postgres=# GRANT ALL ON DATABASE installvirtual TO installvirtual;

Read Also: How to create database in postgres

Upgrade user as Super user in Postgres

Execute the following command to upgrade user as super user.

postgres=# ALTER USER installvirtual SUPERUSER;
postgres=# \du
                                   List of roles
Role name       |                      Attributes                            | Member of
installvirtual  | Superuser                                                  | {}

If you like the tutorial please consider sharing with your friends and colleagues.

If you get any issues in the tutorial please feel free to comment below.

Leave a Reply

Your email address will not be published.


The reCAPTCHA verification period has expired. Please reload the page.

48-Hour Flash Sale! Courses from just $10.99