Redis報錯 : (error) NOAUTH Authentication required.
這個錯誤是因為沒有用密碼登陸認證,可以先輸入密碼試試。
127.0.0.1:6379> auth "yourpassword"
例如密碼是‘123456’,當出現認證問題時候,輸入 auth "123456" 就可以了.
127.0.0.1:6379> set name "hello" (error) NOAUTH Authentication required. 127.0.0.1:6379> (error) NOAUTH Authentication required. (error) ERR unknown command '(error)' 127.0.0.1:6379> auth "root"
如果輸入密碼后出現以下提示:
(error) ERR invalid password
那么就是你的密碼輸入錯誤 , 如果你忘記密碼了, 那么這樣做來查看自己的密碼 :
- 進入redis的安裝目錄(是安裝目錄的),查看redis.windows.config文件
-
用記事本打開,查找 “requirepass foobared”,就能找到你的密碼了。
例如我的密碼是這樣的: requirepass 123456 -
接着cmd 重新進入redis的安裝目錄 :
(1) redis-server.exe redis.windows.conf 打開服務器
(2) 在另一個窗口重新進入該目錄, 輸入 redis-cli.exe 打開客戶端.
(3) 在客戶端 中 輸入 auth “123456” 就可以進去了(你輸入的是你查到的密碼) .
比如(3), 我的是這樣的:
C:\Program Files\redis64-2.8.2101>redis-cli.exe 127.0.0.1:6379> auth "123456" OK
補充報錯 :
1、報下面錯,則是沒有設置密碼
(error) ERR Client sent AUTH, but no password is set
解決方案,可以參考我的另外一篇博客: https://www.cnblogs.com/cndarren/p/12359382.html
2、報錯:MISCONF Redis is configured to save RDB snapshots
(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. 127.0.0.1:6379> config set stop-writes-on-bgsave-error no
翻譯:(錯誤)misconf redis被配置以保存數據庫快照,但misconf redis目前不能在硬盤上持久化。用來修改數據集合的命令不能用,請使用日志的錯誤詳細信息。
解決辦法:
運行 config set stop-writes-on-bgsave-error no命令關閉配置項stop-writes-on-bgsave-error解決該問題。
如下:
127.0.0.1:6379> config set stop-writes-on-bgsave-error no OK 127.0.0.1:6379> set a 110 OK 127.0.0.1:6379> get a "110"