我最近得到了一台新机器,现在想从Github上开展我的项目。 我很好奇如何正确设置我的本地机器上的Postgres数据库。 我在Ubuntu(12.04)上安装了postgresql , pgadmin3和libpq-dev 。
我拉下了这个项目:
git clone https://github.com/thebenedict/cowsnhills.git
并运行:
在某些超时之后,Rails会产生“PGError:服务器意外地closures了连接”
如何在Linux上运行Pg_dump / pg_dumpall命令?
Postgres 9.2 – 恢复转储正在翻译转义的Unicode和破坏Java序列化的对象
Postgresql:由于目标机器主动拒绝,所以无法build立连接
如何在Ubuntu 10.04上使用Postgresql 8.4.4生成uuid?
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" ....
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服务器时,我得到:
heroku db:当我没有指定密码时,由于缺less密码而导致失败
python manage.py syncdb失败,“错误地configuration:没有名为'psycopg2'的模块
我们如何从Denormalized文本文件中build立normalized表格?
首先,安装postgresql
sudo add-apt-repository ppa:pitti/postgresql sudo apt-get update #Now install postgresql sudo apt-get install postgresql-9.1 libpq-dev
sudo su postgres createuser user_name #Shall the new role be a superuser? (y/n) y
的Gemfile
#gem 'MysqL2' gem 'pg'
捆绑安装
development.yml
development: adapter: postgresql database: app_development pool: 5 username: user_name password:
当我找到相同的答案时,我遇到了你的问题。 我试图按照@ prasad.surase给你的指示。 我发现的问题是ppa资料库在12.04 LTS即将贬值。 相反,我发现这个链接,它真的帮助。
Postgresql安装在Ubuntu 12.04的Rails开发
通过包管理器安装postgresql和管理工具
sudo apt-get install postgresql libpq-dev PHPpgadmin pgadmin3
sudo su postgres -c psql
create user username with password 'password';
使用与Ubuntu用户相同的名称和密码设置你的postgres用户,并让他成为postgres超级用户
alter user username superuser;
创建开发和测试数据库
create database projectname_development; create database projectname_test;
grant all privileges on database projectname_development to username; grant all privileges on database projectname_test to username;
结束postgresql会话类型q
alter user username with password 'new password';
你可以按照这个链接http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/
创建一个postgres用户并替换database.yml中的凭证
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。