The maximum execution time for PHP scripts is set to 30 seconds by default, so if a script runs for longer than 30 seconds, PHP stops the script and reports an error.
The file you are looking for is php.ini file. Edit that file, find max_execution_time and increase from the default 30 to higher amount of time, say 180. Like this:
before: max_execution_time=30
after: max_execution_time=180
Save the file and restart Xampp.
This may also mean an underlying issue, like blocked port, unreachable host or IP, wrong username or password. You may want to check those with regular php connections....
Try PDO like so:
//connect to database
function dbconnect(){
$servername = "localhost"; $username = "yourusernae"; $password = "yourpassword"; $dbname = "yourdbname";
try{
$pdoconn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$pdoconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
die("OOPs something went wrong. Connection Failed.");
}
echo 'Connected to MySQL';
return $pdoconn;
}
You may also want to disable your firewall and antivirus, then try again with these disable just to rule out any of these being the culprit.
You can also try MySQL Workbench too, it works quite well.