Thursday , November 21 2024

How To Create a User On PostgreSQL And List All Users

To create a user in PostgreSQL, we first connect to PostgreSQL.

To connect to PostgreSQL

You can read the article named “How To Connect To Database On PostgreSQL“.

After connecting, you can create user with the following script.

You can give permission to this user in any database.

But if you do not want unauthorized users in PostgreSQL to create a table under the public schema, I recommend you read the following article.

Why PostgreSQL Allows Non-Privileged Users To Create Tables

Because users created in PostgreSQL are allowed to connect to a database, they can create tables under the default schema, the public schema.

It was weird when I first heard about it. They will probably limit it in the future. This is still the case in version 10.0.

And you can list all users with below command

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *