0

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?

Eonil
  • 10,459
  • 16
  • 36
  • 54

1 Answers1

0

Connect to template1 database and use pgsql user:

 # su pgsql
 $ psql template1

or

 $ sudo -u pgsql psql template1
ooshro
  • 11,134
  • 1
  • 32
  • 31
  • I connected to default database `postgres` with command `sudo -u pgsql psql postgres`. Thanks! – Eonil Feb 27 '11 at 10:23