# yum install postgresql
# yum install postgresql-server
# apt-get install postgresql
# postgresql-setup initdb
-
Set method of the address
127.0.0.1and::1totrustat thepg_hba.conffile. The directory might not be visible to non-sudoers. Runsudo sufirst.- In Fedora, RHEL, CentOS, or similar OS, the file location is
/var/lib/pgsql/data/pg_hba.conf - In Debian, Ubuntu, Mint, or similar OS, the file location is
/etc/postgresql/$version/main/pg_hba.conf
- In Fedora, RHEL, CentOS, or similar OS, the file location is
-
Login to psql shell:
$ psql --host=localhost --user=postgres -
Set password inside psql shell:
\password -
Logout of psql shell with
\qor press Ctrl+D on your keyboard. -
Return method of the address
127.0.0.1and::1tomd5at thepg_hba.conffile.- Just revert the action on Step #1
-
Restart postgres service:
# service postgresql restart -
Login to psql shell again with the password you set.
$ psql --host=localhost --user=postgresThis action should prompt you with password.
service postgresql restart might not work. Enable first the postgres service:
# systemctl enable postgresql.service