Con*_*ech 26 postgresql ubuntu ruby-on-rails rails-postgresql postgresql-9.1
我最近买了一台新机器,现在想从Github处理我的项目.我很好奇如何在我的本地机器上正确设置Postgres数据库.我有postgresql,pgadmin3并libpq-dev安装在Ubuntu(12.04)上.
我拉下项目:
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"
....
Run Code Online (Sandbox Code Playgroud)
该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
Run Code Online (Sandbox Code Playgroud)
设置Postgres数据库的正确方法是什么,以便我可以在本地计算机上运行此项目?
现在,当我启动Rails服务器时,我得到:

Dan*_*iel 52
在寻找相同的答案时,我遇到了你的问题.我试图按照@ prasad.surase给你的指示.我发现的问题是ppa存储库将在12.04 LTS即将贬值.相反,我找到了这个链接,它真的有帮助.
在Ubuntu 12.04中进行Rails开发的PostgreSQL设置
通过包管理器安装postgresql和admin工具
sudo apt-get install postgresql libpq-dev phppgadmin pgadmin3
Run Code Online (Sandbox Code Playgroud)以postgres用户身份登录postgresql提示符
sudo su postgres -c psql
Run Code Online (Sandbox Code Playgroud)为您的项目创建一个postgresql用户
create user username with password 'password';
Run Code Online (Sandbox Code Playgroud)使用与Ubuntu用户相同的名称和密码设置postgres用户,并使他成为postgres超级用户
alter user username superuser;
Run Code Online (Sandbox Code Playgroud)创建开发和测试数据库
create database projectname_development;
create database projectname_test;
Run Code Online (Sandbox Code Playgroud)在数据库上为用户授予权限
grant all privileges on database projectname_development to username;
grant all privileges on database projectname_test to username;
Run Code Online (Sandbox Code Playgroud)结束postgresql会话类型 \q
更新用户的密码
alter user username with password ‘new password’;
Run Code Online (Sandbox Code Playgroud)
pra*_*ase 18
首先,安装postgresql
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
#now install postgresql
sudo apt-get install postgresql-9.1 libpq-dev
Run Code Online (Sandbox Code Playgroud)
在psql中创建一个新用户
sudo su postgres
createuser user_name #Shall the new role be a superuser? (y/n) y
Run Code Online (Sandbox Code Playgroud)
的Gemfile
gem 'pg'
Run Code Online (Sandbox Code Playgroud)
捆绑安装
development.ymldevelopment:
adapter: postgresql
database: app_development
pool: 5
username: user_name
password:
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39802 次 |
| 最近记录: |