PG :: ConnectionBad FATAL:角色“Myname”不存在 [英] PG::ConnectionBad FATAL: role "Myname" does not exist

查看:141
本文介绍了PG :: ConnectionBad FATAL:角色“Myname”不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PostgreSQL,以便我可以部署到Heroku。但是我不能再运行localhost为什么?我收到以下消息:

I am trying to use PostgreSQL so that I can deploy to Heroku. However I cannot run localhost anymore why? I get the following message:

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

这是我的databse.yml

Here is my databse.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 

这是我的gemfile:

Here is my gemfile:

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上)

It seems that pg needs me to create a user or databse however I am unable to or don't know how. Couldn't find any commands that worked for me(I'm on a windows btw)

我能做什么?

推荐答案

我必须进入我的PG管理仪表板并在那里创建一个数据库/用户。不幸的是,它位于与在线教程不同的子目录中(可能更新了目录目的地的最新更新)。幸运的是,我能够找到它并在那里创建表格/用户,更新我的database.yml文件,然后我的应用程序就可以工作了!

I had to go into my PG admin dashboard and create a db/user there. Unfrotunately it was in a subdirectory different from what the tutorials online said(probably updated directory destination last update). Fortunately I was able to find it and create the table/user there, update my database.yml file and then my app was able to work!

这篇关于PG :: ConnectionBad FATAL:角色“Myname”不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆