1. 程式人生 > >Redis報錯 : (error) NOAUTH Authentication required.

Redis報錯 : (error) NOAUTH Authentication required.

這個錯誤是因為沒有用密碼登陸認證 , 先輸入密碼試試 .

127.0.0.1:6379> auth "yourpassword"

例如密碼是‘root’,當出現認證問題時候,輸入“auth ‘root’”就可以了.

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

那麼就是你的密碼輸入錯誤 , 如果你忘記密碼了, 那麼這樣做來檢視自己的密碼 :

  1. 進入redis的安裝目錄(是安裝目錄的),檢視redis.config檔案
    我的是windows下的redis:
  2. 用記事本開啟,找到 “requirepass foobared”,就能找到你的密碼了.
    比如我的密碼是這樣的: requirepass 123456 也就是123456
    密碼

  3. 接著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


補充:報錯
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"