How to set a password for Redis Server?

If you are working the Redis on your local machine, you don’t really need to set the password. But when you want to setup the live server, you will need to set a password for security reason.

Step 1. Check the current password

redis 127.0.0.1:6379> AUTH PASSWORD
(error) ERR Client sent AUTH, but no password is set

Step 2. Set a new password

redis 127.0.0.1:6379> CONFIG SET requirepass "<your-password>"
OK

Step 3. Verify your new password

redis 127.0.0.1:6379> AUTH <your-password>
OK

That’s it.

Leave a Reply

Your email address will not be published.