LoginSignup
1
1

More than 5 years have passed since last update.

HomebrewでインストールしたPostgreSQLをRailsから見つける

Posted at

database.yml で接続先のホストなどを指定しなかった場合、UNIX domain socket で通信しようとする。
明示的に指定しなかった場合、既定のファイルパスのうちで見つかったものに繋ぐ。

(これはバックエンドが PostgreSQL に限った話ではない)

/var/pgsql_socket 以下にあることを期待しているが見つからなかった場合、/var/pgsql_socket がなければ作ってから PostgreSQL の設定を変えて再起動すればよい。

sudo mkdir -p /var/pgsql_socket
sudo chown $(id -un):$(id -gn) /var/pgsql_socket
--- old.conf    2012-09-03 02:43:20.000000000 +0900
+++ now.conf    2012-09-03 02:42:45.000000000 +0900
@@ -65,7 +65,7 @@
 # Note:  Increasing max_connections costs ~400 bytes of shared memory per
 # connection slot, plus lock space (see max_locks_per_transaction).
 #superuser_reserved_connections = 3    # (change requires restart)
-#unix_socket_directory = '/var/pgsql_socket'       # (change requires restart)
+unix_socket_directory = '/var/pgsql_socket'        # (change requires restart)
 #unix_socket_group = ''            # (change requires restart)
 #unix_socket_permissions = 0777        # begin with 0 to use octal notation
                    # (change requires restart)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1