Postgres No permission to create user
postgresql, ruby-on-rails
Solution
The username / password you use lack the administrator rights that are necessary for creation users and databases.
Login as administrator and fix the permissions. If you have administrator login credentials, login and use ALTER ROLE to fix the rights on that account.
Problem
I am unable to use rails with postgres. The database wont create: ``` sayth@sayth-TravelMate-5740G:~/testapp2$ rake db:create:all PG::InsufficientPrivilege: ERROR: permission denied to create database : CREATE DATABASE "testapp2_development" ENCODING = 'unicode' .... Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"testapp2_production", "pool"=>5, "username"=>"testapp2", "password"=>nil} ``` So I am following the solution here https://stackoverflow.com/a/8639649 These are the steps i am having issue with. ``` $ psql -d postgres postgres=# create role app_name login createdb; postgres=# \q ``` However when I am in the psql shell to give the create role with createdb ability it fails auth. ``` sayth@sayth-TravelMate-5740G:~/testapp2$ psql -d postgres psql (9.2.4) Type "help" for help. postgres=> create role sayth createdb; ERROR: permission denied to create role postgres=> ``` How then do I create the auth? Edit Update Reviewing http://www.postgresql.org/docs/9.2/static/tutorial-createdb.html And http://www.postgresql.org/docs/9.2/static/database-roles.html But cannot use root to create accounts as it doesn't exist and I need to be root to create it. ``` sayth@sayth-TravelMate-5740G:~$ sudo psql -d postgres [sudo] password for sayth: Sorry, try again. [sudo] password for sayth: psql: FATAL: role "root" does not exist ```