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"

猜你喜欢

转载自blog.csdn.net/qq_31362767/article/details/81382899