Mac安装redis
part 1:安装redis
1、官网下载压缩包
https://github.com/redis/redis/archive/7.0.4.tar.gz
左边的7.0.2
2、解压
tar zxvf redis-7.0.2.tar.gz
3、复制到usr/local目录下
mv redis-7.0.2 /usr/local/
若此时报权限不足可使用:
sudo mv redis-7.0.2 /usr/local/
4、切换到对应目录,编译测试
cd /usr/local/redis-7.0.2
sudo make test
5、编译安装
sudo make install
执行完毕后,执行成功后,会输出以下信息
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
6、Mac修改redis密码
sudo vim /usr/local/redis-7.0.2/redis.conf
command F foobared 并回车,找到以下注释:
然后将该行注释去掉或者改密码
7、开启redis
cd /usr/local/redis-7.0.2/
redis-server redis.conf
或者直接
redis-server /usr/local/redis-7.0.2/redis.conf
8、密码校验
redis-cli
auth foobared
ok
9、缓存校验
127.0.0.1:6379> set name nova
OK
127.0.0.1:6379> get name
"nova"
10、关闭redis
redis-cli shutdown