我正在try 使用PostgreSQL,以便部署到Heroku.但是我不能再运行localhost了为什么?我得到以下信息:

PG::ConnectionBad
FATAL: role "Myname" does not exist

这是我的数据库.yml

development:
  adapter: postgresql
  database: my_database_development
  pool: 5
  timeout: 5000

test:
  adapter: postgresql
  database: my_database_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_database_production
  pool: 5
  timeout: 5000 

这是我的档案:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use pg as the database for Active Record
gem 'pg'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'rails_12factor', group: :production

pg似乎需要我创建一个用户或数据库,但我无法或不知道如何创建.找不到任何适用于我的命令(我使用的是windows btw)

我能做什么?

推荐答案

我必须进入我的PG管理仪表板,在那里创建一个db/用户.令人遗憾的是,它所在的子目录与在线教程所说的不同(可能是上次更新时更新的目录目的地).幸运的是,我能够找到它并在那里创建表/用户,更新我的数据库.yml文件,然后我的应用程序就可以工作了!

Postgresql相关问答推荐

Org.postgresql.util.PSQLException:错误:函数LOWER(BYTEA)不存在

我可以将jsonb_set与来自SELECT语句的新值(第三个参数)一起使用吗?

在postgres中撤销Select后,RLS停止工作

如何查找具有包含花括号内值且遵循模式的属性的顶点?

如何在postgresql中按时间查询

gorm 不生成字符串列

Postgres 低估了导致错误查询计划的行数

如何在 PostgreSQL 的回归测试中测试 TYPE 发送和接收函数

使用包含重复元素的数组 Select 重复值

Postgres 根据自己的估计 Select 一个更费时的查询计划

Spring:如何在 PostgreSQL 中使用 KeyHolder

PostgreSQL 可以对数组元素有唯一性约束吗?

无法登录 PostgreSQL 数据库

psql:致命:connection requires a valid client certificate

如何缩小 pg_toast 表?

错误:ERROR: table name specified more than once

如何将表的一列复制到PostgreSQL中比较相同ID的另一表的列

PostGIS - 将多面体转换为单面体

如何将 PostgreSQL 查询输出导出到 csv 文件

PostgreSQL 中是否有类似 zip() 函数的东西,它结合了两个数组?