PostgreSQL Mountain Lion socket issue

前端 未结 4 1349
旧巷少年郎
旧巷少年郎 2020-12-25 13:39

I\'ve been trying to set up PostgreSQL on my system (OSX 10.8, clean install), but I\'m running into trouble with using psql, createdb, etc. I\'ve

4条回答
  •  甜味超标
    2020-12-25 14:04

    I encountered this same issue when installing PostgreSQL 9.2 via Homebrew. psql that comes with this build looks to /tmp for a socket when called without any options.

    I didn't feel like adding any new environment variables like PGHOST or creating aliases for psql. There's nothing wrong with doing any of these things, but I just didn't feel like adding to the clutter of my environment.

    So, why not just set unix_socket_directory in postgresql.conf to /tmp? I did:

    unix_socket_directory = '/tmp'      # (change requires restart)
    #unix_socket_group = ''             # (change requires restart)
    #unix_socket_permissions = 0777     # begin with 0 to use octal notation
    

    After a reload, I can just run $ psql with no -h option, without having added an alias or environment variable.

提交回复
热议问题