• Java链接Redis时出现 “ERR Client sent AUTH, but no password is set” 异常的原因及解决办法


    Java链接Redis时出现 “ERR Client sent AUTH, but no password is set” 异常的原因及解决办法


    【错误提示】


    redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
    at redis.clients.util.Pool.getResource(Pool.java:53)
    at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
    at cn.hncu.RedisPool.getJedis(RedisPool.java:66)
    at cn.hncu.RedisJava.main(RedisJava.java:15)

    Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
    at redis.clients.jedis.Protocol.processError(Protocol.java:127)
    at redis.clients.jedis.Protocol.process(Protocol.java:161)
    at redis.clients.jedis.Protocol.read(Protocol.java:215)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239)
    at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2139)
    at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:108)
    at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)


    【问题原因】

    Redis服务器没有设置密码,但客户端向其发送了AUTH(authentication,身份验证)请求。

    【解决办法】

    确定Redis启动时指定是哪个配置文件。


    如上图是 redis.windows.conf 文件,用文本编辑工具打开文件,找到“requirepass”,去掉注释设置密码。



    编辑完后保存,重新启动Redis,再运行程序,OK。

  • 相关阅读:
    bzoj2595 / P4294 [WC2008]游览计划
    bzoj4698 / P2463 [SDOI2008]Sandy的卡片
    [bzoj3514]Codechef MARCH14 GERALD07加强版
    [bzoj2440][中山市选2011]完全平方数
    [bzoj2243][SDOI2011]染色
    [bzoj2589]Spoj 10707 Count on a tree II
    [bzoj1452] [JSOI2009]Count
    [bzoj2588][Spoj 10628] Count on a tree
    [bzoj2434][Noi2011]阿狸的打字机
    Codeforces Round #408(div.2)
  • 原文地址:https://www.cnblogs.com/jpfss/p/10159277.html
Copyright © 2020-2023  润新知