When Redis is unable to authenticate using the password specified in the configuration file, it results in the "redis requirepass not working" error. While using the requirepass directive in the configuration file for password authentication, there could be several reasons why it fails. One common cause is that the password mentioned in the configuration file may contain a misspelling or be incorrect. Additionally, Redis may not read the proper configuration file, leading to the password being ignored. Moreover, Redis may lack the correct privileges to read the configuration file.
To fix the "redis requirepass not working" error, the first step is to ensure the password used for authentication matches the one provided in the Redis configuration file. If uncertain of the password, open the Redis configuration file and update the requirepass directive's value.
Another way to address the issue is by verifying if Redis is looking at the right configuration file. Run
redis-cli config get dir command to check the directory where Redis searches for its configuration file. Ensure that the configuration file is present in the designated directory and has the correct name (default: redis.conf).
Additionally, verify if Redis has adequate permissions to read the configuration file. Make sure the Redis user has read access to both the configuration file and parent directory. If Redis runs as a system service, modify its systemd unit file or init script to adjust the permissions. These measures should resolve the "redis requirepass not working" error and enable successful password authentication in Redis.