user1429496
user1429496

Reputation: 313

createuser: could not connect to database postgres in Rails app?

I'm new to using Postgres, and I'm currently trying to create a new user. However, when it asks for a password, I enter my system password, and the authentication keeps failing.

Alex$ createuser user1
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
WARNING: password file "/Users/Alex/.pgpass" has group or world access; permissions should be u=rw (0600) or less
Password:
createuser: could not connect to database postgres: FATAL:  password authentication failed for user "Alex"

I know that I'm entering my system password correctly. Is there another password that I'm supposed to be using, or does this have something to do with the world access error?

Upvotes: 1

Views: 2530

Answers (1)

Desislav Kamenov
Desislav Kamenov

Reputation: 1203

First fix the permissions of .pgpass to 600 and try again (See here http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html) Are you supposed to connect with user Alex to the database?

Upvotes: 2

Related Questions