“Redis 命令行 client 连 server”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) (建立内容为“1”的新页面) |
Jihongchang(讨论 | 贡献) |
||
| 第1行: | 第1行: | ||
| − | 1 | + | === 连时带密码 === |
| + | <syntaxhighlight lang="powershell"> | ||
| + | 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> | ||
| + | </syntaxhighlight>看没看着,都报警告了,这种情况如果在 Linux 服务器上也会被别人 history 看到密码,所以推荐下面一种 | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | === 连上后输入密码 === | ||
| + | <syntaxhighlight lang="powershell"> | ||
| + | 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> | ||
| + | </syntaxhighlight> | ||
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>