MySQL Error "Can't get hostname for your address" in PHP -
i having trouble connecting sql database pointing domain. connect.php
returns following warning:
warning: mysqli::mysqli() [mysqli.mysqli]: (hy000/1042): can't hostname address
connect.php
<?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->connect_error) { echo "falha ao conectar com o banco de dados."; } date_default_timezone_set('america/sao_paulo'); ?>
the weird thing connection works on localhost
, not when upload server (unless use localhost
instead of domain). have tried skip-name-resolve
solution, didn't work.
is there way solve problem?
i had problem time , worked when disabled dns lookup. if option can change my.cnf or my.ini
[mysqld]
skip-name-resolve
Comments
Post a Comment