title: MySQL Error "Can't get hostname for your address" in PHP
body: <p>I am having trouble connecting to my SQL database pointing to the domain. My <code>connect.php</code> returns the following warning:</p>
  
  <blockquote>
    <p>Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/1042): Can't get hostname for your address</p>
  </blockquote>
  
  <p><code>connect.php</code></p>
  
  <pre><code>&lt;?php
      $server = "agenciaeficacia.com.br";
      $user = "my-user";
      $pass = "my-password";
      $db = "my-db";
  
      // CRIA CONEXÃO
      $conexao = new mysqli($server, $user, $pass, $db);
  
      // CHECA CONEXÃO
      if ($conexao-&gt;connect_error) {
          echo "Falha ao conectar com o banco de dados.";
      }   
  
      date_default_timezone_set('America/Sao_Paulo');
  ?&gt;
  </code></pre>
  
  <p>The weird thing is that the connection works on <code>localhost</code>, but not when I upload it to the server (unless I use <code>localhost</code> instead of my domain).
  I have already tried the <code>skip-name-resolve</code> solution, but it didn't work.</p>
  
  <p>Is there another way to solve this problem?</p>