Reputation: 1767
I'd like to learn how to use postgres, so I just installed it, set my password, and added the \bin
and \lib
directories to my system path. I then ran psql
in the command line, typed the password that I just set when I was prompted, and now I receive this error:
psql: error: FATAL: password authentication failed for user "me"
I don't understand why that happened. Any ideas? I am using windows 10.
Upvotes: 1
Views: 3133
Reputation: 44137
The windows installer asks you to specify the password for the super user named "postgres". But if you just type psql
, you are trying to log in as the PostgreSQL which has the same name as your windows OS user. But that PostgreSQL user probably doesn't even exist, much less have the same password as you specified upon installation.
So the first time you log in, you have to tell it to log in as the initial superuser, with -U postgres
. Once logged in, you can create a user named 'me' (create it with a password--possibly the same as the first password you assigned, although generally they would be different), and a database named 'me'. From them on, you could log in as this new user to this new database, just by typing psql
and then giving the password when it asks.
psql -U postgres
In general, the initial user and the initial database are only used for maintenance operations. Other tasks should be done with the users and in the databases you set up after the first time you log in. This isn't "the law" of course, it is just "a good idea".
Upvotes: 5