ERR Client sent AUTH, but no password is set问题解决

时间:2024-04-06 15:41:56

一、错误信息

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)

二、解决方案

1、直接删掉密码,双方都不设置密码(项目配置文件和redies的配置文件)

2、双方都设置密码,redies配置文件设置密码如下:

2.1、打开redis.windows.conf 文件,搜索requirepass,然后将注释放开,将foobared设置成自己想要的密码

ERR Client sent AUTH, but no password is set问题解决

2.2、项目的yml文件中配置 密码

ERR Client sent AUTH, but no password is set问题解决

2.3、重新启动redies服务就OK了