redis.exceptions.AuthenticationError: Authentication required.

import redis

# 创建连接对象
r = redis.Redis(host='localhost',port=6379,db=0)

# 查看所有key
print(r.keys('*'))

上边是pycharm 中的
报这个错误

redis.exceptions.AuthenticationError: Authentication required.
图片说明

下边是终端

127.0.0.1:6379> keys *
1) "age"
2) "name"
127.0.0.1:6379> 

这个报错需要怎么身份验证

需要认证
https://www.cnblogs.com/zhuiluoyu/p/10431643.html