修改redis配置文件redis.conf,找到:
# requirepass foobared
将其修改为:
requirepass yourpassword
其中yourpassword是设置的密码。
修改完成后,重启Redis服务以使更改生效。