redis用户验证

1配置密码认证功能

vim /opt/redis_6379/conf/redis_6379.conf

requirepass 123456

 

2使用密码登陆

方式1:

[root@elk101 ~]# redis-cli
127.0.0.1:6379> set k1 v1
(error) NOAUTH Authentication required.
127.0.0.1:6379> AUTH 123456
OK
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> KEYS *
1) "k1"

 

方式2:

[root@elk101 ~]# redis-cli -a '123456' get k1
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
"v1"

 

上一篇:sql获取每门课程成绩最好的学生信息


下一篇:信息安全复习:1~10