nodename nor servname provided, or not known

mac来使用redis然后产生上述错误,据说是用户名的问题

解决:

    打开终端:

      cat /private/etc/hosts

      sudo vi /private/etc/hosts

     将错误的那个名字加入到hosts当中

     127.0.0.1      错误的名字

     然后保存退出

   刷新下

           dscacheutil -flushcache

   错误解决。

原文地址:https://www.cnblogs.com/liuyangfirst/p/7084532.html