Tutorial: Access Postgresql Database as Default User
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
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
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 ✌🏾🧡.