• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 578
  • Last Modified:

Running a SQL query on my database behind the DMZ

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,

Chris
0
equentin
Asked:
equentin
1 Solution
 
ronnie_bermejoCommented:
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 ..
0
 
arober11Commented:
Hi

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. 11.22.33.44:3306  
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 127.0.0.1 and port 3306

0
 
equentinAuthor Commented:
The settings he mentions are changed in putty and are in addition to the putty login the the web box.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now