1.无密码时的访问
redis-cli -h 127.0.0.1 -p 6379 redis 127.0.0.1:6379> redis 127.0.0.1:6379> keys *1) "myset"2) "mysortset" redis 127.0.0.1:6379> select 1OK
2.有密码时的访问
redis-cli -h 127.0.0.1 -p 6379 -a myRedis redis 127.0.0.1:6379> keys * 1) "myset" 2) "mysortset" redis 127.0.0.1:6379> select 1 OK redis 127.0.0.1:6379[1]> config get requirepass 1) "requirepass" 2) "myRedis" redis 127.0.0.1:6379[1]> config set requirepass my_redis OK redis 127.0.0.1:6379[1]> config get requirepass 1) "requirepass" 2) "my_redis"
设置脚本
E:\redis\redis-2.4.5-win32-win64\64bit\redis-cli.exe -a lihonghua_redis
时间: 2024-10-21 15:09:07