权限不够,需要进入root模式
[root@localhost dengzhan]# cd /home/dengzhan/redis/redis5/bin
[root@localhost bin]# ./redis-cli
127.0.0.1:6379> set name dengzhan
OK
127.0.0.1:6379> get name
"dengzhan"
127.0.0.1:6379> mset age 19 addr suizhou
OK
127.0.0.1:6379> mget age addr
1) "19"
2) "suizhou"
127.0.0.1:6379> mget name age addr
1) "dengzhan"
2) "19"
3) "suizhou"
127.0.0.1:6379> hset user name dengzhan
(integer) 1
127.0.0.1:6379> hget user name
"dengzhan"
127.0.0.1:6379> hmset user age 19 addr suizhou
OK
127.0.0.1:6379> hgetall
(error) ERR wrong number of arguments for 'hgetall' command
127.0.0.1:6379> hgetall user
1) "name"
2) "dengzhan"
3) "age"
4) "19"
5) "addr"
6) "suizhou"
127.0.0.1:6379> lpush student zhangsan lisi
(integer) 2
127.0.0.1:6379> rpush student wangwu
(integer) 3
127.0.0.1:6379> lrange student 0 2
1) "lisi"
2) "zhangsan"
3) "wangwu"
127.0.0.1:6379> llen student
(integer) 3
127.0.0.1:6379> lrem student 1 lisi
(integer) 1
127.0.0.1:6379> lrange student
(error) ERR wrong number of arguments for 'lrange' command
127.0.0.1:6379> lrange student 0 2
1) "zhangsan"
2) "wangwu"
127.0.0.1:6379> sadd letters aaa bbb ccc ddd
(integer) 4
127.0.0.1:6379> smembers letters
1) "aaa"
2) "ddd"
3) "ccc"
4) "bbb"
127.0.0.1:6379> scard letters
(integer) 4
127.0.0.1:6379> srem letters aaa
(integer) 1
127.0.0.1:6379> smembers letters
1) "ddd"
2) "ccc"
3) "bbb"
127.0.0.1:6379> zadd score 1 zhangsan 5 lisi 2 wangwu 7 zhaoliu
(integer) 4
127.0.0.1:6379> zrange score 0 3
1) "zhangsan"
2) "wangwu"
3) "lisi"
4) "zhaoliu"
127.0.0.1:6379> zcard score
(integer) 4
127.0.0.1:6379> zrem score zhangsan
(integer) 1
127.0.0.1:6379> zrange score 0 2
1) "wangwu"
2) "lisi"
3) "zhaoliu"
127.0.0.1:6379> set code test ex 10
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> set code test ex 10
OK
127.0.0.1:6379> get code
"test"
127.0.0.1:6379> ttl code
(integer) -2
127.0.0.1:6379> get code
(nil)
127.0.0.1:6379>
127.0.0.1:6379> set code test
OK
127.0.0.1:6379> ttl code
(integer) -1
127.0.0.1:6379> expire code 10
(integer) 1
127.0.0.1:6379> ttl code
(integer) 8
127.0.0.1:6379>