I'm setting up my PostgreSQL 9.1. I can't do anything with PostgreSQL: can't createdb
, can't createuser
; all operations return the error message
Fatal: role h9uest does not exist
h9uest
is my account name, and I sudo apt-get install
PostgreSQL 9.1 under this account.
Similar error persists for the root
account.
In local user prompt, not root user prompt, type
Then enter password for local user.
Then enter the previous command that generated "role 'username' does not exist."
Above steps solved the problem for me. If not, please send terminal messages for above steps.
After trying many other peoples solutions, and without success, this answer finally helped me.
https://stackoverflow.com/a/16974197/2433309
In short, running
creates a role with name owning_user (in this case, h9uest). After that you can run
rake db:create
from the terminal under whatever account name you set up without having to enter into the postgres environment.Installing postgres using
apt-get
does not create a user role or a database.To create a superuser role and a database for your personal user account:
sudo -u postgres createuser -s $(whoami); createdb $(whoami)
creating role on pgsql with privilege as "superuser"
Then create user
Assign privilege to user
And then enable login that user, so you can run e.g.:
psql template1
, from normal$
terminal:This works for me:
I installed it on macOS and had to:
Here's the source: https://github.com/PostgresApp/PostgresApp/issues/313#issuecomment-192461641