Setup Postgres in development
11 March 2022 (Updated 11 March 2022)
First, make sure you’ve installed Postgres. Let’s assume you’re logged in as the Unix user sajad
.
Create superuser role
sudo -u postgres createuser --interactive
When prompted:
- Give it the name of your main Unix user (e.g.,
sajad
). - Make it super user
Create default database for role
When you login as any role (e.g., sajad
), PG will attempt to connect to a database with the same name as the role by default.
So, you might want to create a default role database:
sudo -u postgres createdb sajad
Test connection
psql
You should be logged in as the role sajad
and connected to the database sajad
.
Tagged:
Postgres
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment