我最近购买了一台新机器,现在想从Github上处理我的项目。 我很好奇如何在本地机器上正确设置Postgres数据库。 我已经在Ubuntu(12.04)上安装了postgresql
,pgadmin3
和libpq-dev
。
我拉取项目:
git clone https://github.com/thebenedict/cowsnhills.git
然后运行:
bundle
。
当我运行:
rake db:create && rake db:schema:load
我收到这个错误:
rake db:create && rake db:schema:load
FATAL: password authentication failed for user "cnh"
FATAL: password authentication failed for user "cnh"
....
config/database.yml
文件看起来像这样:
development:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_development
pool: 5
username: cnh
password: cnh
test:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_test
pool: 5
username: cnh
password: cnh
production:
adapter: postgresql
encoding: unicode
host: localhost
database: cnh_production
pool: 5
username: cnh
password: cnh
如何正确地设置Postgres数据库,以便我可以在本地机器上运行此项目?
目前在启动Rails服务器时,我得到以下内容:
create database app_development owner user_name;
命令,然后执行alter user_name password 'password';
命令。 - Connor Leechcreateuser -s -W user_name
命令时加上-W
参数以强制要求输入密码。否则,它可能不会提示您输入密码,您将不得不使用ALTER
语句在之后设置密码。 - Axel Tetzlaff