We can set the password parameter through the redis configuration file, so that the client needs password verification to connect to the redis service, which can make your redis service more secure.
##Example (Recommended learning: Redis video tutorial)
127.0.0.1:6379> CONFIG get requirepass<br>1) "requirepass"<br>2) ""<br>By default, the requirepass parameter is empty, which means that you can connect to the redis service without passing password authentication. You can modify this parameter through the following command:
127.0.0.1:6379> CONFIG set requirepass "runoob"<br>OK<br>127.0.0.1:6379> CONFIG get requirepass<br>1) "requirepass"<br>2) "runoob"<br>After setting the password, the client needs password verification to connect to the redis service, otherwise the command cannot be executed.
Grammar
The basic syntax format of the AUTH command is as follows:127.0.0.1:6379> AUTH password<br>
Example
127.0.0.1:6379> AUTH "runoob"<br>OK<br>127.0.0.1:6379> SET mykey "Test value"<br>OK<br>127.0.0.1:6379> GET mykey<br>"Test value"<br>More Redis For related technical articles, please visit the
Introduction to Using Redis Database Tutorial column to learn!
The above is the detailed content of Why redis is safe. For more information, please follow other related articles on the PHP Chinese website!