首页 > 解决方案 > FATAL: password authentication failed for user postgres aurora

问题描述

If I create a user logged in as postgres to the root db and create a user... it doesn't work. What am I doing wrong?

postgres=> CREATE ROLE myUser WITH LOGIN PASSWORD 'xxx';
CREATE ROLE
postgres=> GRANT CONNECT ON DATABASE myDatabase TO myUser;
GRANT
postgres=> GRANT USAGE ON SCHEMA public to myUser;
GRANT
postgres=> GRANT SELECT  ON ALL TABLES IN SCHEMA public TO myUser;
GRANT

When I go to authenticate I get an error. psql -h $dbURL -U myUser myDatabase

FATAL: password authentication failed for user myUser

标签: postgresqlamazon-aurora

解决方案


The user you created is "myuser", because case is ignored for SQL identifiers not within double quotes, and folded to lower case. But case is not ignored in command-line tools, so you are trying to log in as non-existent user "myUser". Since non-existent users don't have a password hash, password authentication must fail.


推荐阅读