我是一名有用的助手,可以为您翻译文本。
我正在尝试在Heroku上部署我使用RoR创建的简单博客以进行学习,但不支持sqlite3,因此我决定迁移到PostgreSQL。
我更改了我的database.yml文件。
安装PostgreSQL使用:
我得到了:
我正在尝试在Heroku上部署我使用RoR创建的简单博客以进行学习,但不支持sqlite3,因此我决定迁移到PostgreSQL。
我更改了我的database.yml文件。
development:
adapter: postgresql
encoding: utf8
database: blog_development
pool: 5
username: user
password:
test:
adapter: postgresql
encoding: utf8
database: blog_test
pool: 5
username: user
password:
安装PostgreSQL使用:
brew install postgresql
移除 sqlite3 并添加:
gem 'pg'
并运行了 bundle install
当我尝试运行时:
rake db:create
我得到了:
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
我尝试通过以下方式进行修复:
在Rails中,无法为{"adapter"=>"postgresql"}创建数据库。
以及:
http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
http://www.mozmorris.com/2011/11/15/configure-postgresql-to-accept-tcpip-connections.html
附加信息:
RoR版本:4.0
Ruby版本:2.0.0
psql版本:9.3.1
pg版本:'0.17.0'
操作系统:OSX Mavericks
pgrep -lf postgres
返回什么? - Kevin Sjöbergpg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
来启动它。 - Kevin Sjöberg