PostgreSQL, or Postgres, is a relational database management system that provides an implementation of the SQL querying language. It is a popular choice for many small and large projects and has the advantage of being standards-compliant and having many advanced features like reliable transactions and concurrency without reading locks.
$ sudo apt update $ sudo apt install postgresql postgresql-contrib
The `postgres` user and then running `psql` to open the Postgres prompt.
$ sudo -u postgres psql
Creating a New Role
$ createuser --interactive or $ sudo -u postgres createuser --interactive
Creating a New Database
$ createdb databaseName or $ sudo -u postgres createdb databaseName
Opening a Postgres Prompt with the New Role
$ sudo adduser sammy
Switch over and connect to the database by typing
$ sudo -i -u sammy $ psql Or, $ sudo -u sammy psql
Check Connection Information
quit ot exit
Setting a password for the `postgres` user
$ \password postgres