Skip to content

Supavisor error: "password authentication failed" after rotating database password

Last edited: 10/14/2026

如果通过 Shared Pooler (Supavisor) (aws-[...].pooler.supabase.com,会话模式下端口 5432 或事务模式下端口 6543) 的连接在你更改数据库密码后不久开始因为 password authentication failed for user "..." 失败,即使新密码是正确的,这是预期的行为,不是BUG——除非这种情况持续发生,否则你不需要当作问题处理。

🌐 If connections through the Shared Pooler (Supavisor) (aws-[...].pooler.supabase.com, port 5432 in session mode or 6543 in transaction mode) start failing with password authentication failed for user "..." shortly after you change your database password, even though the new password is correct, this is expected behavior, not a bug — it isn't something you need to treat as a problem unless it persists.

这适用于使用用户名/密码进行认证的常规数据库角色(包括默认的 SCRAM)。它不适用于即时(JIT)访问令牌连接,因为这些连接是在每次连接时实时对 JIT 提供者进行验证,而不是对缓存的密码进行验证。

🌐 This applies to regular database roles authenticating with a username/password (including SCRAM, the default). It does not apply to JIT access-token connections, since those are validated live against the JIT provider on every connection rather than against a cached password.

这是为什么会发生?

  • 连接池器会暂时缓存数据库凭证以提高性能。
  • 在密码刚刚更改后,连接池可能会继续用旧的缓存凭证去检查使用新密码的新连接尝试,从而导致这些连接被拒绝。

如何解决这个问题:

  1. 首先,通过直接连接(绕过连接池),使用像 psql 这样的 Postgres 客户端和新密码确认新密码是否正确。直接连接成功的话,就支持暂时性的连接池缓存诊断。如果直接尝试失败,先检查错误是否是像 28P01 这样的认证失败,然后再判断密码是否错误。
  2. 如果直接连接可用,就通过连接池重试。一旦尝试新连接,通常会促使连接池更新新密码。如果你的数据库已经有活跃的连接池连接,这通常也会在大约15秒内自动发生;如果在你更换密码之前连接池处于空闲状态,那么不会自动发生——你需要实际发起一次重连来触发它。
  3. 在极少数情况下,速率限制或网络延迟可能导致连续几次重连尝试失败,直到一次成功为止。
  4. 避免在短时间内多次更改密码,因为每次更改都会重新开始同一个时间窗口,这会让你更难判断哪次尝试应该成功。
  5. 如果直接连接可以正常工作,但几分钟后 pooler 重新连接仍然失败,联系支持 并说明直接连接已验证可用,这样可以排除瞬时缓存路径的问题。

另见: