Redis 命令行 client 连 server

来自姬鸿昌的知识库
Jihongchang讨论 | 贡献2023年2月18日 (六) 04:31的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

连时带密码

F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6379 -a vn4sj5kbxdaG
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> keys *
1) "codehole"
2) "name"
3) "age"
4) "{phoneList}:config"
5) "test_key"
6) "test_test"
7) "test_key1"
8) "phoneList"
9) "test_key2"
127.0.0.1:6379>

看没看着,都报警告了,这种情况如果在 Linux 服务器上也会被别人 history 看到密码,所以推荐下面一种




连上后输入密码

F:\下载目录\Redis-x64-5.0.14.1>.\redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> auth vn4sj5kbxdaG
OK
127.0.0.1:6379> keys *
1) "codehole"
2) "name"
3) "age"
4) "{phoneList}:config"
5) "test_key"
6) "test_test"
7) "test_key1"
8) "phoneList"
9) "test_key2"
127.0.0.1:6379>