无法启动Postgres [英] Can't get Postgres started

查看:203
本文介绍了无法启动Postgres的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单安装postgresql

brew install postgresql

初始化...

[~] initdb   
The files belonging to this database system will be owned by user "pma".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    UTF-8
  MESSAGES: C
  MONETARY: C
  NUMERIC:  C
  TIME:     C
The default database encoding has accordingly been set to UTF8.
initdb: could not find suitable text search configuration for locale UTF-8
The default text search configuration will be set to "simple".

creating directory /Users/pma/.pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers ... 1600kB
creating configuration files ... ok
creating template1 database in /Users/pma/.pgdata/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    postgres -D /Users/pma/.pgdata
or
    pg_ctl -D /Users/pma/.pgdata -l logfile start

开始...

[~] pg_ctl start
server starting
[~] LOG:  database system was shut down at 2011-11-30 22:41:57 HKT
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

到目前为止一切顺利。 .. Createdb ....

So far so good... Createdb....

[~] createdb test 
createdb: could not connect to database postgres: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

...现在呢?

推荐答案

可能是unixdomain套接字位于其他地方,例如/ tmp

Could be the unixdomain socket is located somewhere else, eg /tmp

尝试将-h标志与localhost或/ tmp一起使用:

Try using a -h flag with either localhost or /tmp :


  • createdb -h localhost测试,或

  • createdb -h / tmp测试

(-h / --hostname标志通常以主机名作为参数,但也会接受目录名,并指定unix的位置-domain socket)

(the -h / --hostname flag normally takes a hostname as argument, but it will accept a directoryname too, specifying the location of the unix-domain socket)

链接到相关主题

这篇关于无法启动Postgres的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆