douchui3933 2014-12-19 15:50
浏览 41

在正确设置完所有内容后无法远程连接到MySQL

I have an issue getting to connect remotely to a MySQL database.

My current set-up is as follows: I have a windows 2008 Server at work, placed behind a router (fixed IP). The router has DMZ configured to the server, which works perfectly fine for everything else I have tested including web server, VPN, FTP, etc... The firewall of the Server is opened to the necessary services on the corresponding ports. I can telnet to all these ports decently.

The only thing that I cannot get to work is remotely connecting to a MySQL database. I have done all of the following:

  • Forward port 3306 to the Server (through DMZ);
  • Configure MySQL to bind to 0.0.0.0:3306 (it automatically does that when not supplying a bind-address);
  • Configure a user account in MySQL with access from localhost;
  • Configure the very same user account (same name, password, rights) with access from '%';
  • Open port 3306 in the Windows Server's firewall.

I am subsequently trying to execute a PHP script from a hosted web server (elsewhere on the internet):

<?php
// Create connection
$conn = new mysqli(<host>, <username>, <password>);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
?>

with <host>, <username> and <password> being the corresponding and correct credentials.

This script simply times out without reply and gives the expected error Connection failed: Can't connect to MySQL server on '<host>' (110). I can also not telnet on port 3306. Connecting from localhost works fine.

I don't know what else I have forgotten or done wrong. What am I missing?

I need this connection in order to keep my 'backup system' centralized on the hosted web server. I could run my 'backup system' locally on the mysql host, but that makes it harder to manage it from the central point. Beside that, I'd like to get it to work to actually know what's going on. I hate not getting this kind of thing to work.

Thanks for anyone who has ideas on what could be wrong.

Kenneth

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。