Programming/PostgreSQL
Jump to navigation
Jump to search
PostgreSQL is an open source object-relational database.
It acts as an alternative to the common database MySQL.
Setup
Syntax
Basics
Accessing the PostgreSQL Shell
Access the PostgreSQL shell with:
psql -U <user_name> -d <database_name>
Exit the shell with:
\q
To access the PostgreSQL shell for the first time (prior to creating any additional users), invoke the postgres
user:
sudo -u postgres psql
Accessing the Linux PostgreSQL Account
Sometimes (rarely), you'll want to access the actual Linux account made for PostgreSQL, rather than just the database user.
To do this, use:
sudo -i -u postgres
This is required for some commands, such as the createuser linux terminal command.