May 16, 2021 Redis
We can set the password parameters through the redis profile so that the client needs password verification to connect to the redis service, which makes your redis service more secure.
We can see if password verification is set up with the following command:
127.0.0.1:6379> CONFIG get requirepass 1) "requirepass" 2) ""
The requirepass parameter is empty by default, which means you can connect to the redis service without password verification.
You can modify this parameter by following the following command:
127.0.0.1:6379> CONFIG set requirepass "w3cschool.cn" OK 127.0.0.1:6379> CONFIG get requirepass 1) "requirepass" 2) "w3cschool.cn"
Once the password is set, the client connection to the redis service requires password authentication, otherwise the command cannot be executed.
The basic syntax format of the AUTH command is as follows:
127.0.0.1:6379> AUTH password
127.0.0.1:6379> AUTH "w3cschool.cn" OK 127.0.0.1:6379> SET mykey "Test value" OK 127.0.0.1:6379> GET mykey "Test value"