Home > Database > Redis > Detailed explanation of how to set password in redis

Detailed explanation of how to set password in redis

Release: 2019-11-29 16:08:34
forward
3288 people have browsed it

Detailed explanation of how to set password in redis

Password setting

Here is a brief introduction to how to set a password for redis (recommended: redis introductory tutorial)

There are two ways to set the redis password, one requires restarting the redis service, and the other does not require restarting the redis service.

First of all, let’s introduce the setting method that needs to restart the redis service.

That is, find the redis configuration file—redis.conf file, and then modify the requirepass inside. This was originally commented out. Remove the comments, set the corresponding fields behind to the password you want, save and exit. Just restart the redis service.

Detailed explanation of how to set password in redis

I set the password here to 123

Then there is a password setting method that does not require restarting the redis service

This is relatively simple , after connecting to redis, set it through the command, as follows:

config set requirepass 123456
Copy after login

In this way, the password is set to 123456

After setting, you can check the password through the following command

config get requirepass
Copy after login

Detailed explanation of how to set password in redis

After the password is set, when you log out and connect to redis again, you need to enter the password, otherwise it will not work. There are two ways to enter the password. One is to enter the password directly when connecting, but to enter the password after connecting, as shown below:

Detailed explanation of how to set password in redisIn fact, there is a small problem, that is, through After the password is changed on the command line, the password after the requirepass field in the configuration file will not be changed accordingly.

The above is the detailed content of Detailed explanation of how to set password in redis. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template