run postgresql with systemctl
sudo pacman -S postgresql
find version & build from source
postgres --version
sudo systemctl status postgresql
--> should not be running
Note: always do this any time you are doing any type of admin work on psql
sudo su - postgres
Note: default db for psql is /var/lib/postgres/data
initdb --locale en_US.UTF-8 -D /var/lib/postgres/data
exit
sudo systemctl status postgresql
--> should not be running
sudo systemctl start postgresql
sudo systemctl status postgresql
--> should be active
sudo su - postgres
Note: user can be called anything however if you create a PostgreSQL user with the same name as your Linux username, it allows you to access the PostgreSQL database shell without having to specify a user to login (which makes it quite convenient).
createuser --interactive
- Enter name of role to add:
MY_LINUX_USERNAME
- Shall the new role be a superuser?:
y
exit
sudo systemctl restart postgresql
Note: can see that it was restarted by looking at the timestamp on the Active field
sudo systemctl status postgresql
worked thanks