windows下载 github地址 : https://github.com/MicrosoftArchive/redis/releases
#设置内存
redis-server.exe redis.windows.conf --maxmemory 200M
将redis加入到windows的服务中(service和loglevel前都是两个-)开机自启动和日志级别设置
redis-server --service-install redis.windows-service.conf --loglevel verbose
#exception:ERR Client sent AUTH, but no password is set
D:\redis>redis-cli.exe
查看是否设置了密码:
127.0.0.1:6379> auth root
(error) ERR Client sent AUTH, but no password is set
说明没有设置密码,执行命令:
127.0.0.1:6379> config set requirepass root
OK
redis 127.0.0.1:6379> CONFIG SET requirepass "123456"
OK
redis 127.0.0.1:6379> AUTH 123456
Ok
在采用 命令 CONFIG SET requirepass "密码"
AUTH 密码
但是这样配置完密码之后再重启Redis服务密码会重置
也就是说每次打开Redis服务都要重新再配置一下密码
Redis目录下的配置文件redis.windows.conf
修改requirepass 属性为要设置的密码
然后重启Redis服务 使用命令的时候别忘了启动配置文件不然修改的密码无效
redis-server.exe redis.windows.conf
#注册安装服务 redis-server --service-install redis.windows.conf --loglevel verbose #卸载服务 #redis-server --service-uninstall
在windows本地搭建redis缓存,添加到本地计算机的服务中,保证每次开机自动启动服务。
原文:https://www.cnblogs.com/foolash/p/12085319.html