NOAUTH: Authentication required
The server requires a password and the connection has not authenticated yet, so every command except AUTH, HELLO and QUIT is refused.
- Error prefix
NOAUTH
它的意義
NOAUTH means the connection reached Redis but never proved who it is. The server has requirepass set or an ACL setup that demands a login, and until the client sends a successful AUTH (or connects with credentials in the URL), every command except AUTH and QUIT is refused with this exact prefix. HELLO is refused too unless it carries the AUTH option, as in HELLO 3 AUTH default s3cret.
It is almost always a client-side configuration gap: the application has no password configured, the credentials went to one pool but a second app or job runner opened its own unauthenticated connection, or a monitoring tool connects directly. The error appears on the first data command rather than at connect time, because RESP does not require authentication up front.
常見原因
- The server has requirepass or ACL authentication enabled and the client connected without sending AUTH.
- The credentials are missing from one specific client, such as a job runner or dashboard, while the main application authenticates fine.
- A proxy or connection pooler forwards commands from a client that never authenticates.
Find the cause
# Does this connection need auth? Run it without credentials: redis-cli -h db.example.com PING # (error) NOAUTH Authentication required. # What the server requires: redis-cli -a s3cret CONFIG GET requirepass redis-cli -a s3cret ACL LIST
如何修正
-
Authenticate the connection right after opening it, or put the credentials in the connection string:
redis-cli -h db.example.com -a s3cret PING # or, inside an existing session: AUTH s3cret
-
Check what the server actually requires before guessing at passwords. On the server host:
redis-cli -a s3cret CONFIG GET requirepass redis-cli -a s3cret ACL LIST
-
Prefer a named ACL user over the legacy global password when you control the server, so each application can be rotated on its own:
ACL SETUSER app on >s3cret ~app:* +@read +@write AUTH app s3cret
Other ways to handle it
Putting the credentials in a redis:// URL keeps the username and password out of a separate AUTH line: redis://default:[email protected]:6379. Typed inline, the URL still lands in shell history just as -a does, so keep it in a config or environment file where that matters. For fleets, named ACL users beat the single requirepass because each application can be re-passworded without touching the others.
安全地重現問題
redis-server --port 7300 --requirepass s3cret --save '' & redis-cli -p 7300 PING # (error) NOAUTH Authentication required. redis-cli -p 7300 -a s3cret PING # PONG
問題
NOAUTH or WRONGPASS: which one means the password was wrong?
NOAUTH means no credentials were sent at all. WRONGPASS means a password or username was sent and the server rejected it.
Why does my client report NOAUTH only on the first query?
RESP lets a client open a connection and start sending immediately. Redis defers the rejection to the first command that needs auth, so pools that authenticate lazily surface the error on the first real command.
Can I just turn auth off?
You can clear it with CONFIG SET requirepass "", but the safer fix is keeping auth on and adding the credentials to the client that is missing them.
相關錯誤
WRONGPASSPassword or username rejectedNOPERMThe ACL user lacks permission1045MySQL:使用者存取被拒18456SQL Server:使用者登入失敗
程式碼和訊息文字來自 Redis documentation and source code。瀏覽完整的 Redis error list 或 搜尋每個資料庫錯誤.
Work on Redis in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.
本頁文字與資料: CC BY 4.0,請註明出處 SQLly (sqlly.app)。 程式碼與 SQL 片段: MIT. 授權詳情 引用的錯誤訊息文字歸其資料庫廠商所有。