How To Define, Add, Create User For Postgres or PostgreSQL Server?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-define-add-create-user-for-postgres-or-postgresql-server/
PINTEREST
PINTEREST
INSTAGRAM

PostgreSQL Database Server have a lot of tools to manage the suite. Creating user is one of the most popular issue to manage Postgres Database. In this tutorial we will examine how to create user with different rights, privileges, database. We will mainly follow createuser tool for these and createuser is a wrapper for the CREATE ROLE Sql statement. By the way we have allready examined the PostgreSQL Database Server installation in the following tutorial.

How To Install PostgreSQL Server Into Linux, Debian, Ubuntu, CentOS, Mint, Fedora, Redhat?

Change Shell To Postgres User

PostgreSQL Database server can be accessed with postgres  user which is created during database installation. We can use sudo  command with -i and -u  parameters by specifying username postgres like below.

Create User with Interactive Questions

The most basic and default scenario for the createuser is interactive questions. In this scenario we do not specify any option. We will only provide the user name we want to create. In the flow we will answer required questions line by line. In this example we will create a user named ismail . We can also provide --interactive option.

Create User with Interactive Questions

Create User with Interactive Questions

Create User Which Do Not Have Create User Privileges

We can create a user by providing password. In this example we will use -P -s and -e options and create user named ahmet . We will be prompted the password and the create role command will be printed with the hash of the password we provided.

LEARN MORE  How To Install PostgreSQL Server Into Linux, Debian, Ubuntu, CentOS, Mint, Fedora, Redhat?

Create User Which Do Not Have Create User Privileges

Create User Which Do Not Have Create User Privileges

The create role sql will be like below.

Create User With No Login

Sometimes we may need new user without login. This user will be very useful as a means of managing database permissions. We can use --no-login  option like below.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-define-add-create-user-for-postgres-or-postgresql-server/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)