Redis(1)windows安装、设置密码、设置windows启动服务

安装环境

  • windows 10
  • Redis-x64-3.0.504

Resis下载

https://github.com/MicrosoftArchive/redis/releases

安装

下载后,解压就完成了安装。

安装截图

启动

E:\Tools\Redis-x64-3.0.504>redis-server.exe redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.0.504 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 19908
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[19908] 24 Jun 17:06:12.931 # Server started, Redis version 3.0.504
[19908] 24 Jun 17:06:12.932 * DB loaded from disk: 0.000 seconds
[19908] 24 Jun 17:06:12.932 * The server is now ready to accept connections on port 6379

设置配置windows 启动服务

执行命令

redis-server --service-install redis.windows-service.conf --loglevel verbose

修改redis.windows-service.conf

# Specify the log file name. Also 'stdout' can be used to force
# Redis to log on the standard output.
logfile "logs/redis_log.txt"

创建logs文件夹
截图演示

服务创建成功,使用命令:services.msc
创建服务截图

注意:如果不创建logs文件夹导致服务启动不起来。报错为:

Windows无法启动Redis服务(位于本地计算机上)。  
错误1067:进程意外终止。

设置密码

修改redis.windows-service.conf

# Require clients to issue AUTH <PASSWORD> before processing any other
# commands.  This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
requirepass password

重启启动服务即可

使用

E:\Tools\Redis-x64-3.0.504>redis-cli.exe 
127.0.0.1:6379> auth password //登录
OK //登录成功
127.0.0.1:6379> config get requirepass //获取密码
1) "requirepass"
2) "password"
127.0.0.1:6379> quit //退出
E:\Tools\Redis-x64-3.0.504>redis-cli.exe -a password //登录
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) "password"
127.0.0.1:6379> quit
E:\Tools\Redis-x64-3.0.504>redis-cli.exe -p 6379 -a password // 登录
127.0.0.1:6379> config get requirepass
1) "requirepass"
2) "password"
127.0.0.1:6379>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Windows安装Redis设置密码的步骤如下: 1. 下载RedisWindows版本,并解压缩到一个目录下。 2. 打开命令行窗口,并进入Redis安装目录。 3. 输入命令redis-cli.exe启动Redis的客户端。 4. 在客户端中输入命令redis-server redis.windows.conf启动Redis服务器。 5. 如果步骤2和3无法启动成功,可以按照下面的步骤操作: a. 在命令行中输入redis-server.exe /path/to/redis.conf启动Redis服务器。 b. 如果出现警告"Warning: no config file specified, using the default config",可以忽略这个警告。 6. 在Redis客户端中输入命令config set requirepass yourpassword来设置密码,将"yourpassword"替换为你自己的密码。 7. 输入命令config rewrite,将密码设置写入Redis配置文件。 8. 关闭Redis服务器。 9. 重新启动Redis服务器,确保密码设置成功。 请注意,以上步骤仅适用于临时设置密码。如果想要长期设置密码,需要修改Redis配置文件redis.windows.conf,将其中的"requirepass"项的值修改为你想要的密码,并重新启动Redis服务器。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [Windows 安装Redis遇到得问题,设置密码。](https://blog.csdn.net/huangkx0412/article/details/128091732)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [如何给windows版本redis设置密码](https://blog.csdn.net/qq_46112274/article/details/123269709)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值