Installing PostgreSQL

1
2
3
4
$ sudo pacman -S postgresql
$ sudo -u postgres -i
[postgres]$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
[postgres]$ exit
1
$ pg_ctl -D /var/lib/postgres/data -l logfile start
1
2
$ systemctl start postgresql.service
$ systemctl enable postgresql.service

Create your first database/user

Access the database shell

1
$ [postgres]$ psql -d myDatabaseName
1
2
3
4
5
6
\help
\c <database>
\du        # list all users and their permission levels
\dt        # show summary information about all tables
\q
\?        # See all meta-commands, help you get started.