title: mysqli::mysqli(): (HY000/2002) localhost not working
body: <p>I am trying to connect to my data base and i get an error when I use 127.0.0.1 instead of localhost.</p>
  
  <pre><code>Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
  </code></pre>
  
  <p>If I use localhost instead of 127.0.0.1 it works fine. Anyone have any insight into this?</p>
  
  <p>the code used to connect is</p>
  
  <pre><code>&lt;?php
      $db = new mysqli('127.0.0.1', 'root', '', 'dbname');
  ?&gt;
  </code></pre>