Startup Of Postgresql
2018-10-13
Installation and Configuration
- Install by
sudo pacman -Sy postgresql
.
- Switch to postgres user by
sudo -u postgres -i
.
- Initialize database cluster by
initdb -D '/var/lib/postgres/data'
.
- Switch to user with sudo and run postgresql server by
systemctl start postgresql.service
.
- Switch to postgres user and create postgresql user by
createuser --interactive
.
- Switch to user and create db by
createdb dbname
.
- Enter postgresql REPL by
psql -d dbname
.
CXX client interface
- Install by
sudo pacman -Sy libpqxx
.
- Use by
#include <pqxx/pqxx>
.
- Compile by
clang++ -lpqxx app.cc
.