doufei0933
doufei0933
2012-04-11 11:27

通过PHP脚本隧道连接到MySQL

Here's the question, I need to connect to a remote MySQL database from my C# Application, problem is the MySQL instance will block all access to all IP's apart from localhost, this can not be changed as its too much of a security issue.

The question is, is it possible to connect via a tunnel instead to a php script hosted on the server, this would then act as the mysql connection.

Any ideas and suggestions?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • dongqian3198 dongqian3198 9年前

    I ended up with going for an SSH port tunnel and achieving what I needed to do that way.

    点赞 评论 复制链接分享
  • donglaohua1671 donglaohua1671 9年前

    yes, just create a simple PHP script that will give you the desired output and use http request from the c# application to that php script to get the data - basically, you'll be building a very simple REST API (with authentication)

    p.s. I don't see how that would be more secure than SSH tunnelling

    点赞 评论 复制链接分享
  • dsxcv5652 dsxcv5652 9年前

    SQLYog (a mysql management GUI utility) already has this php tunnel script with its own custom API, so if you consider writing it yourself, would be nice to have cross-support. See Is there any good universal PHP MySQL HTTP tunnel?

    点赞 评论 复制链接分享

为你推荐