title: Connect to server database from localhost
body: <p>What I'm trying to do is connecting to server database from localhost.</p>
  
  <pre><code>$host = 'http://www.my-domain.com/phpmyadmin/';
  $user = 'u5er';
  $pass = 'pa55w0rd';
  $db = 'db_name';
  
  $con = mysqli_connect($host,$user,$pass,$db) or die("Error " . mysqli_error($con));
  $sql = "SELECT col FROM test WHERE id = '1'";
  
  $result = mysqli_query($con,$sql);
  </code></pre>
  
  <p>Errors</p>
  
  <pre><code>Warning: mysqli_connect(): in C:\xampp\htdocs\sp_concord\cenova_nabidka\page\vytvor.php on line 362
  
  Warning: mysqli_connect(): in C:\xampp\htdocs\sp_concord\cenova_nabidka\page\vytvor.php on line 362
  
  Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\xampp\htdocs\sp_concord\cenova_nabidka\page\vytvor.php on line 362
  Error
  </code></pre>
  
  <p>Is it possible to resolve it? How to find out if my server allows external connections? And how to define from which IP addresses it should allow access to database?</p>
  
  <p>Thank you for any suggestion.</p>
  
  <p><strong>EDIT:</strong>
  Ok, I have changed the host to my-domain.com and now it reports the following errors. My IP has no acces to MySQL server...</p>
  
  <pre><code>Warning: mysqli_connect(): (HY000/1130): Host '88.146.210.54' is not allowed to connect to this MySQL server in C:\xampp\htdocs\sp_concord\cenova_nabidka\page\vytvor.php on line 362
  Failed to connect to MySQL: Host '88.146.210.54' is not allowed to connect to this MySQL server
  Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:\xampp\htdocs\sp_concord\cenova_nabidka\page\vytvor.php on line 368
  </code></pre>