How to fix ERR invalid password in Redis

RedisBEGINNERHIGHUpdated Dec 29, 2025ยท 138 views

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.

Quick fix

Fixes ERR invalid password

grep -i "requirepass" /etc/redis/redis.conf
# or
grep -i "requirepass" /usr/local/etc/redis.conf
  1. Verify the Redis server password configuration
  2. Test authentication with redis-cli
  3. Fix connection strings in your application
  4. Check for special characters in password
redis โ€” error
grep -i "requirepass" /etc/redis/redis.conf
# or
grep -i "requirepass" /usr/local/etc/redis.conf
ERR invalid password

What this error means

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.

Typical symptoms

  • Connection attempts to Redis fail with 'ERR invalid password' message
  • redis-cli fails to authenticate when using -a flag with password
  • Applications cannot connect to Redis with provided credentials
  • Error appears in application logs when trying to access Redis
  • Connections work without authentication but fail with AUTH command

Common causes

  1. The password provided is incorrect and does not match the requirepass setting on the Redis server
  2. Redis server has requirepass configured but your connection attempt does not include any password
  3. Password contains special characters that were not properly escaped in connection strings or command-line arguments
  4. Using wrong username:password format for Redis 6+ ACL authentication (should be 'username:password' not just 'password')
  5. Configuration mismatch between what you think the password is and what Redis server actually has set

How to fix "ERR invalid password"

1Verify the Redis server password configuration

Check what password is currently configured on your Redis server. If you have access to the server, check the redis.conf file:

bash
grep -i "requirepass" /etc/redis/redis.conf
# or
grep -i "requirepass" /usr/local/etc/redis.conf

If the server is running, you can also check using redis-cli if you have a password hint:

bash
redis-cli CONFIG GET requirepass

Note the exact password string (including capitalization and special characters).

2Test authentication with redis-cli

Try connecting to Redis with the correct password using redis-cli:

bash
redis-cli -h localhost -p 6379 -a YOUR_PASSWORD

Replace 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':

bash
redis-cli -h localhost -p 6379 -a "username:password"

If authentication succeeds, your password is correct.

3Fix connection strings in your application

Update your application's Redis connection string to include the correct password. Examples:

Node.js (redis-js or ioredis):

javascript
const redis = require('redis');
const client = redis.createClient({
  host: 'localhost',
  port: 6379,
  password: 'YOUR_PASSWORD'  // Add this line
});

Python (redis-py):

python
import redis
r = redis.Redis(
    host='localhost',
    port=6379,
    password='YOUR_PASSWORD',  # Add this line
    decode_responses=True
)

Java (Jedis):

java
Jedis jedis = new Jedis("localhost", 6379);
jedis.auth("YOUR_PASSWORD");  // Add this line

Replace YOUR_PASSWORD with your actual Redis password.

4Check for special characters in 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:

bash
redis-cli -a 'YOUR_PASSWORD_WITH_$PECIAL_CHARS' -h localhost

In connection URLs, special characters may need URL encoding (e.g., @ becomes %40):

bash
redis://:myPassword%40123@localhost:6379
5Reset Redis password if needed

If you've forgotten the password, you can reset it by stopping Redis and editing redis.conf directly:

bash
# 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 redis

Test the new password:

bash
redis-cli -a YOUR_NEW_PASSWORD

Advanced notes

Redis 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.

Frequently asked questions

What does "ERR invalid password" mean?
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.
How do I fix "ERR invalid password"?
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.
What causes "ERR invalid password"?
The password provided is incorrect and does not match the requirepass setting on the Redis server Redis server has requirepass configured but your connection attempt does not include any password Password contains special characters that were not properly escaped in connection strings or command-line arguments
Is the "ERR invalid password" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading