DEV Community

Damil Shahzad
Damil Shahzad

Posted on

Database Initialization and Creation for Testing in PostgreSQL 12.0 with Age (Part 2)

Introduction:

In my previous blog, we looked into the process of sourcing and installing PostgreSQL and age. You can find the first part of the series here:

https://dev.to/damilshahzad7/setting-up-apache-age-with-postgresql-a-comprehensive-installation-guide-for-macos-part-1-3keh

Creating and validating the database cluster:

Initialising the database cluster:
cd postgresql-12.0
which psql
ls /usr/local/pgsql/bin/
export PATH=/usr/local/pgsql/bin/:$PATH
export PGDATA=/usr/local/pgsql/bin/data
sudo chown -R damil /usr/local/pgsql/

Use initdb command to initialize the database cluster, this command generates the essential directories and files for a fresh database cluster:
initdb --username=<database superuser name> [other options] <database cluster location>

Start the Server:

pg_ctl start -l log

Validate the server status:

pg_ctl status -l log

psql command is used to connect to a PostgreSQL database server. psql is a command-line interface for PostgreSQL database. When you run the psql command, you will be logged into the postgres database as the current operating system.
psql postgres

Top comments (0)