sudo pacman -R postgresql postgresql-libs
sudo rm -rfv /var/lib/postgres
sudo pacman -S postgresql postgresql-libs
sudo passwd postgres
sudo vim /usr/lib/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local compatibility
[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
sudo vim /etc/rc.local
#!/bin/sh -e
#
# rc.local
exit 0
sudo chmod +x /etc/rc.local
sudo systemctl enable rc-local.service
sudo su - postgres
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
exit
sudo systemctl start postgresql.service
You can run that with the follwing command
psql -U postgres
This won't ask for the password but you can force that wit -W
option like
psql -U postgres -W
However, you can also pass the -d
option to connect directly with database
mentioned like psql -U username -d dbname
.
๐ Hope this helps you ๐