Running a SQL query on my database behind the DMZ

Posted on 2009-12-16
Medium Priority
Last Modified: 2012-05-08
Hi All,

I am working on a web app that is hosted on a web server in a demilitarized zone (DMZ). I need to run MySQL queries on the database that is on its own server which is on the same local network as the web server, but not accessible via the internet.

I can access the Web Server using putty, and the web server has MySQL installed. I can also SFTP sql files to the webserver.

I feel like I have all the Tools I'm just mising some knowhow! Any help on how I can execute these sql files would be greatly appreciated.

Thanks in advance,

Question by:equentin

Expert Comment

ID: 26064997
Check this questio/post #: 24929908

There you can see how you can connected to your web server.
Once you are there is just a matter to write your query to a file and the run
echo $query > sqlfile.txt
mysql < sqlfile.txt

you can ftp the files as well

Let me now ..
LVL 26

Accepted Solution

arober11 earned 2000 total points
ID: 26131026

If you wish to use a local GUI tool (MySQL workbench, Toad, Eclipse...) you could set-up a tunnel via your putty session, to the web-server, on to the DB server.

To do this load your saved session / enter the details for a new on then :

1) select:  "Session->Connection->SSH->Tunnels" in the right hand pane
2) stick a local port in source port e.g. 3306  enter the Mysql server IP and port in the Destination box e.g.  
3) Click "add".
4) Select: "Session", in the right hand pane.
5) Click "Save" session.
6) Click Open
7) Once connected, in your local Mysql tool open a connection to the database via IP and port 3306


Author Closing Comment

ID: 31666899
The settings he mentions are changed in putty and are in addition to the putty login the the web box.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, we’ll look at how to deploy ProxySQL.
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question