[Redis-CentOS7]Redis设置连接密码(九)
设置Redis密码
- 修改/etc/redis.conf 一定要强密码redis为内存存储 抗暴力破解强
requirepass password
重启服务
systemctl restart redis
登录redis
# redis-cli
127.0.0.1:6379> set username 'leoshi'
(error) NOAUTH Authentication required.
验证密码
127.0.0.1:6379> AUTH 123456
(error) ERR invalid password
127.0.0.1:6379> AUTH password
OK
127.0.0.1:6379> set username 'leoshi'
OK
命令直接登录
# redis-cli -h 127.0.0.1 -p 6379 -a password
127.0.0.1:6379> set baidu "www.baidu.com"
OK