<?php
$servername = "192.168.179.130";
$username = "root";
$password = "";
$dbname = "rawcdr";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
The above code gives a warning Warning: mysqli::mysqli(): (HY000/2002) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\new_table\index.php on line 59.
The host is a different server (CentOS 7), and i have checked its reach ability. I have also provided special privilege in mysql server by:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%' IDENTIFIED BY PASSWORD '';
Also started the firewall service by:
service firewalld start
Checked the port 3306 is open by following command:
netstat -nlp | grep 3306
localhost- RiggsFolly