gpt4 book ai didi

ruby-on-rails - PG::ConnectionBad FATAL:角色 "Myname"不存在

转载 作者:行者123 更新时间:2023-11-29 11:09:06 24 4
gpt4 key购买 nike

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

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

这是我的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:

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

我能做什么?

最佳答案

错误是“角色“Myname”不存在”,

为 Postgresql 创建用户“Myname”

sudo -u postgres createuser --superuser Myname

它将解决这个问题。

关于ruby-on-rails - PG::ConnectionBad FATAL:角色 "Myname"不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23338356/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com