设置验证密码的方式有两种
第一种修改配置文件
[root@localhost conf]# vi redis.conf 480 # requirepass foobared 改为 480 requirepass bbs.centoscn.vip
关闭或者重启redis服务后进行测试
第二种直接在redis里面设置
[root@localhost ~]# redis-cli 127.0.0.1:6379> config set requirepass bbs.centoscn.vip OK 127.0.0.1:6379> auth 'bbs.centoscn.vip' OK
输入密码的两种方式
[root@localhost ~]# redis-cli (error) NOAUTH Authentication required. 127.0.0.1:6379> auth 'bbs.centoscn.vip' OK
第二种
[root@localhost ~]# redis-cli -h 127.0.0.1 -p 6379 -a bbs.centoscn.vip 127.0.0.1:6379> set f h OK 127.0.0.1:6379>
验证
[root@localhost conf]# redis-cli 127.0.0.1:6379> set q 不输入密码会报如下错误 (error) ERR wrong number of arguments for 'set' command 127.0.0.1:6379> sadd myset "one" 这个也是 (error) NOAUTH Authentication required. 127.0.0.1:6379> auth 'bbs.centoscn.vip' OK 127.0.0.1:6379> sadd myset "one" 输了密码后 (integer) 1
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论