我已经安装了 PostgreSQL 8.4 pkg_add -r postgres84-server
。我添加了“postgresql_enable="YES" to
/etc/rc.conf , and executed
/usr/local/etc/rc.d/postgresql initdb”。
当我运行psql
启动时,它打印了以下错误:
%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
%
如何运行 PostgreSQL 控制台?需要什么?
答案1
连接到 template1 数据库并使用 pgsql 用户:
# su pgsql
$ psql template1
或者
$ sudo -u pgsql psql template1