Postgresql – Post-installation process of PostgreSQL 8.4 in FreeBSD

consolefreebsdinstallationpostgresqlprocess

I have installed PostgreSQL 8.4 with pkg_add -r postgres84-server.
I added 'postgresql_enable="YES"to/etc/rc.conf, and executed/usr/local/etc/rc.d/postgresql initdb`.

And when I run psql to start, it printed these errors:

%psql
psql: FATAL:  database "eonil" does not exist
%psql -U postgres
psql: FATAL:  role "postgres" does not exist
%psql -U psql
psql: FATAL:  database "psql" does not exist
%psql -U pgsql
psql: FATAL:  database "pgsql" does not exist
%sudo psql 
psql: FATAL:  database "root" does not exist
%sudo -u pgsql psql
psql: FATAL:  database "pgsql" does not exist
%sudo -u psql psql
sudo: unknown user: psql
%

How can I run PostgreSQL console? What's required?

Best Answer

Connect to template1 database and use pgsql user:

 # su pgsql
 $ psql template1

or

 $ sudo -u pgsql psql template1