2

I am on Linux Mint Cinnamon 2.2.16.

During the process of getting Rails up and running, I am having problems with Postgres.

postgres@BL ~ $ psql --version
psql (Postgres-XC) 1.1
(based on PostgreSQL) 9.2.4

I was unable to get anything working under my usual username, so I changed to the default user using

sudo su - postgres

I cannot get anything to work with createuser.

postgres@BL ~ $ psql
psql: FATAL:  role "postgres" does not exist

postgres@BL ~ $ createuser -s -U $USER
createuser: could not connect to database postgres: FATAL:  role "postgres" does not exist

postgres@BL ~ $ sudo -u postgres createuser newname
Sorry, user postgres is not allowed to execute '/usr/bin/createuser newname' as postgres on BL.

postgres@BL ~ $ which psql
/usr/bin/psql
postgres@BL ~ $ psql \l
psql: FATAL:  role "postgres" does not exist
Amit Tripathi
  • 7,003
  • 6
  • 32
  • 58
Paige
  • 43
  • 1
  • 6
  • Try this solution: http://stackoverflow.com/questions/15301826/psql-fatal-role-postgres-does-not-exist – zmii Jun 02 '15 at 21:35
  • I get no output out of $ psql \l, instead gives me the same FATAL: role "postgres" does not exist. Makes me think I have no users at all, but require a user to create a user...? – Paige Jun 02 '15 at 22:47

2 Answers2

1

After thoroughly researching the problem and tearing out more than a few hairs, I decided this was some variation of a problem with packaging/installation, similar problem noted here: unable to create user postgres: role "postgres" does not exists

I did a complete uninstall, as per below, and reinstalled without postgresql-xc

How to thoroughly purge and reinstall postgresql on ubuntu?

The new install had expected behavior with the user "postgres" and I was able to add myself as a superuser and create new databases. After some post-installation finagling, Rails seems to be running and playing nice with postgres.

Community
  • 1
  • 1
Paige
  • 43
  • 1
  • 6
0

You have to authenticate to psql as the superuser in order to manage users. For example

psql -U root

Afterwards

create user paige with password 'paige';

Sean Xiao
  • 606
  • 1
  • 12
  • 20
  • Unfortunately, getting the same error here. postgres@BL ~ $ psql -U root psql: FATAL: role "root" does not exist – Paige Jun 02 '15 at 22:41
  • Do you remember the username you first used when installing postgres? – Sean Xiao Jun 03 '15 at 14:36
  • I don't believe I created a user with a unique name, though it did ask if I wanted to create a password for the "admin 'root' user", which I did. Is there any other standard user name beside admin, root, user, or postgres ? – Paige Jun 03 '15 at 15:13