Fixed the problem that the Redis password failed after restart

  • 2020-06-01 11:17:34
  • OfStack

There may be two reasons:

1. The password is simply set on the command line, which is temporary and will be invalid when the server is restarted.


config set requirepass yourPassword 

Solution: configure the password directly in the redis configuration file

One line in the configuration file looks like this


#requirepass foobared 

Uncomment and change foobared to your own password

Such as:


requirepass mypwd 

2. If you have set the password in the configuration file according to the above method, but it is still invalid after startup, it means that you have not specified the configuration file to run. The server will also issue the following warning:


Warning: no config file specified, using the default config. 

The correct startup mode under windows:


redis-server.exe redis.windows.conf 

After the configuration file is specified, the password can be read on startup.


Related articles: