进入redis安装目录编辑redis.conf
1.开启redis后台运行
2.修改redis密码
3.启动redis
[root@localhost redis-6.2.6]# src/redis-server redis.conf
4.进入redis
[root@localhost redis-6.2.6]# src/redis-cli -a 123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> ping
PONG