PostgreSQL create account and database
Last updated: Jul 02, 2022
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';
Creating a user through the pgAdmin program.
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.
Thank you all, I hope that my article helped you in some way.