0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RailsにてPostgreSQL使用の共同アプリ開発の導入手順

Last updated at Posted at 2020-02-06

共同開発用アプリをgit clonebundle installbundle exec rails db:createした際に

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"?
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"XXX"}
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"?

のエラーが発生。ローカルで共同アプリ用のPostgreSQLを構築するため、以下対応が必要。

# PostgreSQLのインストール(PostgreSQLがインストールされていない場合 )

brew install postgresql
# macに初期データが有る場合があるので一度削除、初期化

rm -rf /usr/local/var/postgres
initdb /usr/local/var/postgres -E utf8
# PostgreSQLの起動

brew services start postgresql
# PostgreSQLの動作確認

psql -l

問題なければ以下を実行し、完了。

bundle exec rails db:create
bundle exec rails db:migrate

##参考記事
・Railsのプロジェクトに途中から参加するとき
https://uncode.co.jp/web/rails%E3%81%AE%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88%E3%81%AB%E9%80%94%E4%B8%AD%E3%81%8B%E3%82%89%E5%8F%82%E5%8A%A0%E3%81%99%E3%82%8B%E3%81%A8%E3%81%8D/

・macOS SierraへのPostgreSQLインストール
https://morizyun.github.io/database/postgresql-install-mac.html

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?