redis,

How to update Redis password

Aug 14, 2022 · 1 min read · 5 views · Post a comment

By default, Redis ships the default user without any password configured, which is okay as long as you have Redis deployed in a private subnet behind a firewall. However, if you want to add or update the password there are two ways to do so.

Prerequisites

  • Redis

Solution(s)

From the CLI

Step 1. Login to your Redis CLI and run the following command:

CONFIG SET requirepass "<super_strong_password_here>"

Step 2. Test it.

AUTH <super_strong_password_here>

Expected output:

OK

redis.conf

Step 1. Open the redis.conf file which is found under the /etc/redis directory.

Step 2. Find and uncomment the following line:

# requirepass foobared

Step 3. Replace foobared with your password by choice, save and close the config. For instance:

requirepass <super_strong_password_here>

Step 4. Restart the Redis service.

systemctl restart redis-server

Step 5. Login to your Redis CLI and verify the password.

AUTH <super_strong_password_here>

Expected output:

OK

Conclusion

To find more cool Redis commands and hacks, simply browse the Redis category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.