error when trying to connect springboot to Redis

created at 06-02-2022 views: 14

error

org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is 
io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.

If you encounter this problem, first check whether the Redis service is started When using springboot's 2.2.6.RELEASE version to connect to Redis, an error is reported at startup

connect to redis

The configuration file is as follows

spring.redis.host=127.0.0.1
spring.redis.port=6379

error screenshot

reason

The reason for the error is that no password was set for Redis when Redis was installed and configured.

solution

Now to set the password, add it to the springboot configuration file

Find the Redis installation directory and find the redis.windows.conf file

find file

Add and modify the requirepass attribute

set password

Then go to the installation directory to find redis-cli.exe

  1. Set the password: config set requirepass "123456"
  2. Connect to redis, authentication: auth 123456

set password

Finally, add the password to the configuration file:

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=123456
created at:06-02-2022
edited at: 06-02-2022: