Ruby on rails 使用Ruby on Rails的PostgreSQL用户

Ruby on rails 使用Ruby on Rails的PostgreSQL用户,ruby-on-rails,ruby,postgresql,heroku,Ruby On Rails,Ruby,Postgresql,Heroku,我正在尝试在heroku上部署我的应用程序。为此,我将sqlite3改为pg,因为heroku不支持sqlite3。我在database.yml中更改了一些内容: # SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: postgresql

我正在尝试在heroku上部署我的应用程序。为此,我将sqlite3改为pg,因为heroku不支持sqlite3。我在database.yml中更改了一些内容:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.pg

# 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:
  <<: *default
  database: db/test.pg

production:
  <<: *default
  database: db/my_database_production.pg

我该怎么办?

您需要将用户“flo”添加到本地postgres实例中(我通常只是将其作为超级用户添加,因此我没有权限问题)。在终端中运行此命令:

createuser -P -s -e flo
系统还会提示您设置密码。现在让我们使用“flo”。然后,您需要将其添加到databases.yml文件中:

development:
  <<: *default
  database: db/development.pg
  username: flo
  password: flo
开发:

要么向您的
config/database.yml
中添加一些PostgreSQL用户,要么编辑
/etc/PostgreSQL/9.x/main/pg_hba.conf
文件,并添加您的用户相应权限。@blemupt我似乎只有postgres xc…这真的是postgres数据库的有效方法(
数据库:db/development.pg
)?我以后再也看不到它了…database:db/my_database\u production.pg我说我想在哪里创建它,当我运行bundler exec rake db:create它应该创建它…在哪里可以找到它
database:db/my_database\u production.pg
?你能发布一些链接或其他信息吗?为什么需要编写可扩展的群集
postgres xc
而不是普通的
postgres
?createuser-P-s-e flo为新角色输入密码:再次输入:7createuser:无法连接到数据库postgres:致命:角色“flo”不存在
createuser -P -s -e flo
development:
  <<: *default
  database: db/development.pg
  username: flo
  password: flo