PostgreSQL create account and database

PostgreSQL create account and database

Colleagues hello to all.

In today's article, we'll talk about how to create a user and a database in PostgreSQL. In PostgreSQL, you can create any number of databases on a single server. It is recommended to create a database with the same name as the user.

 

Creating a normal database user via the console.

sql> CREATE ROLE grafana WITH LOGIN NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'Qwerty1'; 

postgresql_create_user_database

 

Creating a user through the pgAdmin program.

postgresql_create_user_database

 

After creating an account, you can now create a database.

sql> CREATE DATABASE grafana WITH OWNER = grafana TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1;

 

Creating a database through the pgAdmin program.

postgresql_create_user_database


 

Thank you all, I hope that my article helped you in some way.

SIMILAR ARTICLES

PostgreSQL - How to determine which files on disk correspond to tables in a database
PostgreSQL - How to determine which files on disk correspond to tables in a database
POSTGRESQL
Read more
PostgreSQL - How to find out the size of tables in a database
PostgreSQL - How to find out the size of tables in a database
POSTGRESQL
Read more
PostgreSQL - How to check user privileges
PostgreSQL - How to check user privileges
POSTGRESQL
Read more