The "ERR invalid password" error occurs when you attempt to authenticate to a Redis server with an incorrect or mismatched password. This is a security measure to protect your Redis instance from unauthorized access.
Redis requires authentication when the requirepass configuration is set on the server. When you try to connect using redis-cli, a client library, or any Redis tool without providing the correct password, or with a wrong password, Redis rejects the connection with this error. This is a critical security feature that prevents unauthorized access to your data store. In Redis 6.0 and later, the authentication system was expanded with ACL (Access Control Lists) support, which allows for multiple users with different passwords and permissions. However, the basic authentication mechanism still requires the correct password.
Check what password is currently configured on your Redis server. If you have access to the server, check the redis.conf file:
grep -i "requirepass" /etc/redis/redis.conf
# or
grep -i "requirepass" /usr/local/etc/redis.confIf the server is running, you can also check using redis-cli if you have a password hint:
redis-cli CONFIG GET requirepassNote the exact password string (including capitalization and special characters).
Try connecting to Redis with the correct password using redis-cli:
redis-cli -h localhost -p 6379 -a YOUR_PASSWORDReplace YOUR_PASSWORD with the actual password. If this works, you'll see the redis> prompt.
For Redis 6+ with ACL, use the format 'username:password':
redis-cli -h localhost -p 6379 -a "username:password"If authentication succeeds, your password is correct.
Update your application's Redis connection string to include the correct password. Examples:
Node.js (redis-js or ioredis):
const redis = require('redis');
const client = redis.createClient({
host: 'localhost',
port: 6379,
password: 'YOUR_PASSWORD' // Add this line
});Python (redis-py):
import redis
r = redis.Redis(
host='localhost',
port=6379,
password='YOUR_PASSWORD', # Add this line
decode_responses=True
)Java (Jedis):
Jedis jedis = new Jedis("localhost", 6379);
jedis.auth("YOUR_PASSWORD"); // Add this lineReplace YOUR_PASSWORD with your actual Redis password.
If your password contains special characters (@, $, #, etc.), ensure they are properly escaped or quoted in connection strings.
For command-line usage, wrap the password in single quotes to prevent shell interpretation:
redis-cli -a 'YOUR_PASSWORD_WITH_$PECIAL_CHARS' -h localhostIn connection URLs, special characters may need URL encoding (e.g., @ becomes %40):
redis://:myPassword%40123@localhost:6379If you've forgotten the password, you can reset it by stopping Redis and editing redis.conf directly:
# Stop Redis
sudo systemctl stop redis
# Edit the configuration file
sudo nano /etc/redis/redis.conf
# Find and change or uncomment the requirepass line:
# requirepass YOUR_NEW_PASSWORD
# Save and restart
sudo systemctl start redisTest the new password:
redis-cli -a YOUR_NEW_PASSWORDRedis 6.0+ introduced ACL (Access Control Lists) which allows more granular permission control beyond simple password authentication. If you're using Redis 6+, you may need to specify both username and password in the format 'username:password'. The default user is 'default'.
If you're using Redis in a managed service (AWS ElastiCache, Azure Cache, DigitalOcean, etc.), credentials might be generated automatically or managed through their console. Check your service provider's documentation for password reset or generation procedures.
For cluster deployments, ensure all nodes have consistent authentication settings to avoid partial connection failures.
ERR fsync error
How to fix "ERR fsync error" in Redis
CLUSTERDOWN The cluster is down
How to fix 'CLUSTERDOWN The cluster is down' in Redis
ERR Job for redis-server.service failed because a timeout was exceeded
Job for redis-server.service failed because a timeout was exceeded
ERR Unbalanced XREAD list of streams
How to fix "ERR Unbalanced XREAD list" in Redis
ERR syntax error
How to fix "ERR syntax error" in Redis