When you install PostgreSQL newly, you will only be able to access it as superuser postgres. In this tutorial, you will learn how to access PostgreSQL as the default terminal user.
Step 1: Change the default terminal user to postgres
sudo su - postgres
Step 2: Enter the PostgreSQL shell
psql
Step 3: Create superuser
Create a superuser, say vicradon, with login privileges
CREATE ROLE vicradon LOGIN SUPERUSER;
Step 4: Create a database for that superuser
CREATE DATABASE vicradon
Step 5: Test your configuration
Open a new terminal and enter psql directly
psql
This should give something like
Congratulations π, you can now execute postgres specific commands like createdb some_db
directly in your terminal as default user. Please, subscribe to my newsletter (at the top) and follow me on Twitter. Thanks for reading. Adios βπΎπ§‘.
Β