Php: Mysql connect with ssh hostname

In my sql host environment when I try to connect to mysql I have to go through a ssh host. Here is my connection:

ssh hostname: server01
username : user
pwd: password

mysqlhostname : mysql01
port : 3306
username : mysqluser
pwd: mysqlpwd

How can I connect to the database in php?

Answers


You can't. What you need to do is setup an SSH tunnel from your webserver to your SSH host and then use localhost with the port of your tunnel in PHP.


Need Your Help

How to compare values for last and second last entry in table?

sql oracle syntax

I have a table in Oracle called quotes with two columns: date and value.

how to programmatically back-out, deduce, decompile, reverse-engineer the algorithm used to construct a variable in a data set

r algorithm regression decision-tree data-analysis

i'm looking for some algorithm or program or function that will deduce how a variable was created, so long as i supply the other variables. i think computer programmers would call this "decompilin...