0

I am trying to connect my local PHP program from one PC and Mysql from a server or another PC. But I got following error when I tried this

Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\bharat\bharat\connect.php

Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\bharat\bharat\connect.php

Warning: mysqli_error() expects parameter 1 to be mysqli, string given in D:\xampp\htdocs\bharat\bharat\connect.php

<?php
$con = mysqli_connect('https://192.168.43.215', 'root', '12345678', 'bharat') or die(mysqli_error("Error connection"));

I tried to keep mysql database in remote server for data security and software in local machine. Can any one tell me the exact way. Thank you.

Community
  • 1
  • 1
Ajoy
  • 189
  • 1
  • 5
  • 17

1 Answers1

1

You don't need the https://, this would be sufficient:

<?php
$con = mysqli_connect('192.168.43.215', 'root', '12345678', 'bharat') or die(mysqli_error("Error connection"));
Anne Douwe
  • 681
  • 1
  • 5
  • 19
  • Did this but it shows Warning: mysqli_connect(): (HY000/1130): Host 'Ajoy-PC' is not allowed to connect to this MariaDB server in D:\xampp\htdocs\bharat\bharat\connect.php on line 5 Warning: mysqli_error() expects parameter 1 to be mysqli, string given in D:\xampp\htdocs\bharat\bharat\connect.php on line 5 – Ajoy Feb 01 '18 at 15:50
  • when I try to connect with my hosting server mysqli_connect(): (HY000/1045): Access denied for user 'bharatmain'@'47.29.226.179' (using password: YES) – Ajoy Feb 01 '18 at 15:55
  • https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server – Mike Feb 01 '18 at 15:59