The main reason is that a password is set on the redis server, but no password is specified when connecting in the console or program.
You can look at the configuration file /etc/redis.conf under linux
requirepass 123456
You can look at the configuration file /usr/local/etc/redis.conf under mac
requirepass 123456
Then you can connect remotely.
redis-cli -h 192.168.0.12 -p 6379 -a 123456