兰州市城乡建设局网官网站,凡客诚品特色,双语网站建设哪家便宜,网站底部备案代码给 Redis 设置密码
Redis 设置密码需要在 Redis 配置文件中进行#xff0c;具体如下#xff1a;
打开 redis.conf 文件。若Redis是通过源码安装的#xff0c;则该文件默认位于 /usr/local/redis/redis.conf。
使用文本编辑器#xff08;如vim#xff09;打开 redis.con…给 Redis 设置密码
Redis 设置密码需要在 Redis 配置文件中进行具体如下
打开 redis.conf 文件。若Redis是通过源码安装的则该文件默认位于 /usr/local/redis/redis.conf。
使用文本编辑器如vim打开 redis.conf 文件找到设置密码的相关配置项
# requirepass foobared在该行代码前添加#表示注释然后在下一行添加如下代码
# 设置密码为 yourpassword
requirepass yourpassword修改代码中的 yourpassword 为你期望设置的密码。
保存并关闭redis.conf文件。
在命令行中使用如下命令连接Redis服务器redis-cli -h host -p port -a password
# 带密码访问 -a password
redis-cli -h 192.168.25.201 -p 6379 -a 123456