使用XAMPP连接到远程MySql服务器

时间:2015-05-27 14:35:43

标签: php mysql phpmyadmin xampp localhost

我有一个脚本,我希望它运行超过5分钟。但我目前的托管服务不允许我修改php.ini中的max_time_limit(设置为2分钟)... 所以我认为我可以使用XAMPP运行脚本并将数据发送到我的数据库,但我无法连接到远程数据库。

这是连接的代码:

$servername = "217.70.186.108"; //I've also tried with the name of the webpage (metagame.gg)
$username = "the_username"; //the username is not root since I've read that root can only connect from localhost. This user has all privileges. This user was created with the permision to be connected from any server (%)
$password = "the_password";
$dbname = "the_db";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

显示以下错误:

  

连接失败:尝试连接时发生错误,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而在建立的连接中失败。

任何帮助都将受到高度赞赏

0 个答案:

没有答案