Redis answers NOAUTH Authentication required
NOAUTH Authentication required.Short answer
NOAUTH means the Redis server needs a login and the connection did not send one. A password in redis.conf (requirepass) or a disabled default ACL user causes it. You may be talking to a different Redis than you think. Find out what the server enforces, then pass the password or user in the client's URL.
Fix it fast
1Find out which cause you have
Ask the server what it enforces. This works without logging in only if you pass the password, so try the config file first.
redis-cli -h 127.0.0.1 -p 6379 ping sudo grep -E "^(requirepass|user |aclfile)" /etc/redis/redis.conf2Match what you see, then jump to its fix
- 1
The config grep shows a requirepass line, or ping fails with NOAUTH.requirepass is set, the client sends no passwordFix - 2
Your provider or admin gave you a username as well as a password.An ACL user is required (Redis 6 and later)Fix - 3
Your local Redis has no password, but the error appears from the app. The app's environment points at another host, or a password-protected container, instance or managed service.The app talks to a different Redis than the one you configuredFix
- 1
What does the error look like?
NOAUTH Authentication required.(error) NOAUTH Authentication required.
Cause 1 of 3
requirepass is set, the client sends no password
1Check
With requirepass, Redis refuses every command until AUTH succeeds.
sudo grep -n requirepass /etc/redis/redis.conf2Fix
Pass the password in the client. For redis-cli use -a or the REDISCLI_AUTH variable; in apps put it in the connection URL.
export REDISCLI_AUTH='your-password'
redis-cli ping
# app connection URL
REDIS_URL=redis://:your-password@127.0.0.1:6379/03Verify
Ping returns PONG.
redis-cli pingConfirmed by redis.io
Cause 2 of 3
An ACL user is required (Redis 6 and later)
1Check
If the default user is off or has a password, new connections start unauthenticated. The two-argument form AUTH <username> <password> logs in as a named user.
redis-cli --user app_user --pass 'your-password' ACL WHOAMI2Fix
Send both the username and password. In a URL that is redis://username:password@host:port.
REDIS_URL=redis://app_user:your-password@127.0.0.1:6379/03Verify
ACL WHOAMI prints the user name.
redis-cli --user app_user --pass 'your-password' ACL WHOAMIConfirmed by redis.io
Cause 3 of 3
The app talks to a different Redis than the one you configured
1Check
Print the URL or host the app really uses, and compare with the instance you tested with redis-cli.
env | grep -i redis
redis-cli -u "$REDIS_URL" ping2Fix
Use the password for that instance, or point the app at the unprotected local one for development.
REDIS_URL=redis://127.0.0.1:6379/03Verify
The same URL works in redis-cli and in the app.
redis-cli -u "$REDIS_URL" pingConfirmed by redis.io
How do I stop it coming back?
- Keep the Redis URL, with password, in one environment variable that the app and your tools both read.
- Do not put the password on the command line in shared shells: use REDISCLI_AUTH.
- Use a long password from ACL GENPASS.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Databases
Jedis cannot borrow a connection from its pool
Caused by: java.net.SocketTimeoutException
The pool could not give the code a working connection in time.
3 causes, each with a fixDatabases
node-redis throws ConnectionTimeoutError on connect
Redis Client Error ConnectionTimeoutError
node-redis raises ConnectionTimeoutError when the socket does not connect within socket.connectTimeout, which is 5000 ms by default.
3 causes, each with a fixDatabases
node-redis throws The client is closed when you send a command
ClientClosedError: The client is closed
node-redis throws ClientClosedError when the client's socket is not open.
3 causes, each with a fixDatabases
redis-cli says Connection refused on a Mac with Homebrew
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Connection refused means nothing is listening on that port.
3 causes, each with a fixDatabases
Redis cannot save dump.rdb because it is not allowed to write there
Permission denied
Redis writes its snapshot into the directory set by dir, using the account the server runs as.
3 causes, each with a fixDatabases
Redis answers every command with LOADING after a restart
(error) LOADING Redis is loading the dataset in memory
LOADING means the server is up but still reading its RDB or AOF file back into memory, so it refuses most commands until that finishes.
3 causes, each with a fix