Rails:PostgreSQLエラー( ;∀;)

パソコンを再起動して、サーバーを立ち上げ直し、localhost:3000にアクセスしたらエラーが出た。

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”?

試してみたこと

■パスが認識されていないのかも?

export PGDATA=/usr/local/var/postgres

■一旦、アンインストールする

$ brew uninstall postgresql
$ brew install postgresql

もう一度アクセスすると、エラーが変わった!前進

FATAL:  database "myapp_development" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
$ ps aux|grep sql
myname        7638   0.0  0.1  2603532  13480   ??  S     6:18PM   0:00.02 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
myname        7689   0.0  0.0  2442000    624 s012  S+    6:19PM   0:00.00 grep sql

DBを作り直す

$ rake db:create
$ rake db:migrate

再起動時にPostgreSQL自動起動してないからよくなかったのでした。