で新しいアプリを開始しました
rails <appname> new -d postgresql
最近 Postgres をインストールしましたが、アプリで使用するのはこれが初めてです。大量のモデルを生成してから rake db:migrate を実行したところ、次のエラーが発生しました。
rake aborted!
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
これは Postgres を間違ってインストールしたということですか? 何を修正すればよいですか?それとも、複数のモデルを一度に移行しようとすることに問題があるのでしょうか? これがばかげた質問である場合は申し訳ありません。私はRailsとpostgresの両方が初めてです。
----- 私のデータベース.YML -----
development:
adapter: postgresql
encoding: unicode
database: <appname>_development
pool: 5
username: <appname>
password:
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
#port: 5432
# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public
# Minimum log levels, in increasing order:
# debug5, debug4, debug3, debug2, debug1,
# log, notice, warning, error, fatal, and panic
# The server defaults to notice.
#min_messages: warning
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: unicode
database: <appname>_test
pool: 5
username: <appname>
password:
production:
adapter: postgresql
encoding: unicode
database: <appname>_production
pool: 5
username: <appname>
password:
--- initdb /usr/local/var/postgres -E utf8 を実行 ---
以下を得ました:
initdb /usr/local/var/postgres -E utf8
The files belonging to this database system will be owned by user "sashafklein".
This user must also own the server process.
The database cluster will be initialized with locale en_US.UTF-8.
The default text search configuration will be set to "english".
initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an argument other than "/usr/local/var/postgres".