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

那么就是你的密码输入错误 , 如果你忘记密码了, 那么这样做来查看自己的密码 :

  1. 进入redis的安装目录(是安装目录的),查看redis.windows.config文件
  2. 用记事本打开,查找 “requirepass foobared”,就能找到你的密码了。
    例如我的密码是这样的: requirepass 123456 

  3. 接着cmd 重新进入redis的安装目录 :
    (1) redis-server.exe redis.windows.conf 打开服务器
    (2) 在另一个窗口重新进入该目录, 输入 redis-cli.exe 打开客户端.
    (3) 在客户端 中 输入 auth “123456” 就可以进去了(你输入的是你查到的密码) .
    比如(3), 我的是这样的:

C:Program Filesredis64-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"
内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/cndarren/p/12359302.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!