Setting up postgres in Ruby on Rails in Cloud9



Hi there, I set up postgres for development and production for my ruby on rails app and it was working but I needed to reset it. When I did, I deleted my development database and when I try to recreate it I get the below.

1-rake db:create
PG::InsufficientPrivilege: ERROR: permission denied to create database

2-then I follow online guides to change the permissions and try to log in using sudo -u postgres psql -d template1 or sudo -u postgres psql -i
I’m asked for the sudo password for ubuntu which I don’t know ([sudo] password for ubuntu: )

Question, is there a way that I can reset this or log in to create a new account that will bypass the permissions needed. It seems that the ubuntu account is stopping me also from creating a new user.

…** edit on this, I’m trying now to log in to the hba config file in postgres to change access privileges. When I use the SHOW hba_file; command from the terminal I see where the hba file is in /var/lib/postgresql/9.3/main. I get an error message saying access denied unless I log in under the root user. But when I log in and access the directory, the hba file doesn’t exist in the list of files?

…*** edit again, I figured out that the role was the problem, the role that I had in my yml file was not a superuser and didn’t have create:db privileges, I changed the username and password on my yml file and that worked. I’m not sure if that’s the recommended way to do it but it worked.