RailsでPostgreSQLが動作しない 解決方法
バージョン
SQLite3だとできていたのにPostgreSQLでdb:migrateしたらエラーが発生。
rails aborted! PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
解決方法
initdb /usr/local/var/postgres postgres -D /usr/local/var/postgres
postgresを起動させていないだけだった。
しかし
Caused by: PG::ConnectionBad: FATAL: database "myapp_development" does not exist
となった。データベースを作成する必要がある。
rake db:create rake db:migrate
うまく動作した。
sqlite3だとこんなことしなくてよかったので気づかなかった。