I created a database on 000webhost and I created a connection with PDO to access it from my localhost on vertrigo
<?php
//CONSTANTES
define('HOST', 'databases.000webhost.com');
define('USUARIO', 'meuusuario');
define('SENHA', 'minhasenha');
define('DB', 'id1342846_central');
// FUNÇÃO DE CONEXÃO
function conecta() {
$dns = "mysql:host=" . HOST . ";dbname=" . DB;
try {
$conn = new PDO($dns, USUARIO, SENHA);
$conn -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $conn;
} catch(PDOException $erro) {
echo $erro -> getMessage();
}
}
?>
but the connection is denied and has the following information SQLSTATE [HY000] [2002] No connections can be made because the target machine has actively refused them. Is there anyway connect to this database externally?