[Password] redis

1. The first embodiment (this method of the current configuration redis linux is a temporary password, the password after the restart will fail if redis,)

(1) First enter redis, if not open redis you'll need to open:
[root @ iZ94jzcra1hZ bin] # redis-cli -p 6379
127.0.0.1:6379> 
(2) view the current redis have not set a password:
127.0.0.1: 6379> GET requirepass config
. 1) "requirepass"
2) ""
(. 3) as described above does not display a password, so now to set the password:
127.0.0.1:6379> config sET requirepass ABCDEFG
the OK
127.0.0.1:6379> 
(. 4) View current redis it again prompted for a password:
127.0.0.1:6379> config GET requirepass
(error) NOAUTH Authentication required.
127.0.0.1:6379>

2. The second method (permanent way)
to be permanently configure a password, then go redis.conf profile found requirepass this parameter, as follows:

Redis.conf modify configuration files  

Requirepass foobared #
requirepass specify a password 123 123

After saving it reboot redis

Guess you like

Origin www.cnblogs.com/xiangtunmizu/p/11695319.html