<> Password setting
Here is a brief introduction redis How to set password
redis There are two ways to set the password , One requires restart redis service , One that does not require restart redis service .
first , Introduce the need to restart redis Service setting method
Find redis Configuration file for —redis.conf file , Then modify the inside requirepass, This was originally annotated , Remove comments , And set the following corresponding fields to your desired password , Save exit . restart redis service , that will do .
I set the password here 123
Then there is no need to restart redis Password setting method of service
This is relatively simple , connect redis after , Set by command , as follows ：
config set requirepass 123456
such , Set the password to 123456
After setting , The password can be viewed through the following instructions
config get requirepass
After password setting , When you quit and connect again redis When , You need to enter the password , Otherwise, it cannot be operated . There are two ways to enter the password , First, enter the password directly when connecting , Instead, enter the password after connecting , Respectively as follows ：
In fact, there is a small problem , namely , After changing the password through the command line , Of the configuration file requirepass The password after the field will not be changed .