The server has redis installed. For security, set the password to access redis-server.
1. Open the redis configuration file
vi` `/usr/local/redis/etc/redis``.conf
Add the requirepass password
Will bind 127.0.0.1::1 before #Remove
Save and exit
2. Close redis
/usr/local/redis/bin/redis-cli` `shutdown
Start redis
/usr/local/redis/bin/redis-server` `/usr/local/redis/etc/redis``.conf
3. Check
/usr/local/redis/bin/redis-cli
The password has been set successfully. A password is required to enter. Enter the password
##4. How to close redis after setting the password/usr/local/redis/bin/redis-cli` `-a 密码 ``shutdown
The above is the detailed content of How to set redis password under Linux. For more information, please follow other related articles on the PHP Chinese website!