0

this code cannot connect another domain database , I have tried..

<?php 
$con_mail = mysqli_connect("domain","user","pass","db"); 
// Check connection 
if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
} 
?>

my error is

"mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'joojmail.com' (110)"

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

1

A frequent security setting used in SQL Server is to only allow local access.

If you can connect to a local database but another domain does not work I would think your access is blocked by the server.

marv51
  • 366
  • 1
  • 11
  • cannot understand – thiyaga rajan Dec 08 '16 at 11:24
  • MYSQL User accounts have 2 parts 1) the userid 2) the place(s) where they are allowed to connect FROM. If the account you are using does not allow REMOTE connection you cannot connect remotely – RiggsFolly Dec 08 '16 at 11:28
  • Try to connect to the database with a desktop app first, something like [HeidiSQL](http://www.heidisql.com/). Then you know if it generally works. – marv51 Dec 08 '16 at 11:30