Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 

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  

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 

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)

What can I do?

like image 640
user3408293 Avatar asked Apr 28 '14 10:04

user3408293


1 Answers

The error is "role "Myname" does not exist",

create the user "Myname" for Postgresql

sudo -u postgres createuser --superuser Myname

it will solve this issue.

like image 113
errakeshpd Avatar answered Sep 22 '22 15:09

errakeshpd