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

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.


What worked for me was: createuser -P -d -e Myname.

-P  If given, createuser will issue a prompt for the password of the new user.
      This is not necessary if you do not plan on using password authentication.
-d  The new user will be allowed to create databases.
-e  Echo the commands that createuser generates and sends to the server.

If you install Postgresql with homebrew on OSX, there is no default postgres user, and you won't be able to use psql directly without setting up a user first.


On Windows, I believe it is a little easier.

Install postgresql and PGAdmin for your system. See this

Create a user named postgres and give it a password. You will be nicely prompted to do this.

Then, when you want to create databases, just right click on your connection and choose New Database. The names of these databases should correspond to what is written in your database.yml

Run rake db:migrate RAILS_ENV=development (development| test| production).

These steps worked for me.