Reputation: 17
Warning: mysqli_connect(): (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\app\htdocs\index.php on line 2
<?php
$con = mysqli_connect('192.168.103.102', 'sysadmin', 'sysadmin123', 'system');
if($con) {
echo "Connected\n";
}
else
{
echo "Not connected\n";
}
Upvotes: 0
Views: 310
Reputation: 12
You should try this way and also use localhost instead of your ip.
$con = mysqli_connect("localhost", "sysadmin", "sysadmin123", "system");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
If the error still persist try to put your file in htdocs on xampp folder.
Upvotes: 0