473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

php connect to mysql via ssh

I would like to encrypt data passed between my web server and the
database server. I have looked all over, but don't see any information
on how to connect to mysql via ssh with php. Is it possible?

Sep 12 '07 #1
5 4571
On Sep 12, 4:00 pm, mtuller <mitul...@gmail.comwrote:
I would like to encrypt data passed between my web server and the
database server. I have looked all over, but don't see any information
on how to connect to mysql via ssh with php. Is it possible?
You want to use SSH tunneling to do this. Basically, suppose PHP is
running on hostA and MySQL is running on hostB. You then SSH from
hostA to hostB like this:

ssh -L 3306:hostB:3306 hostB

What this says is "From hostA ssh to hostB. When you do that, make
port 3306 on hostA forward everything over to port 3306 on hostB."

Finally you tell PHP to connect to use localhost (hostA) as it's
database server and it should just magically work.

You can even set up the SSH connection on a different machine. So,
from hostC you would do:

ssh -L *:3306:hostB:3306 hostB

And then configure PHP to use hostC as it's database server.

Sep 12 '07 #2
On Wed, 12 Sep 2007 20:00:33 -0000, mtuller <mi******@gmail.comwrote:
>I would like to encrypt data passed between my web server and the
database server.
How about:

http://www.php.net/manual/en/function.mysql-connect.php

client_flags, MYSQL_CLIENT_SSL
>I have looked all over, but don't see any information
on how to connect to mysql via ssh
Well, you could set up an SSH tunnel for the relevant port (3306, using the -D
flag, or use stunnel or something else like that) and run the standard
(unencrypted) MySQL protocol through the encrypted tunnel, but that's another
step on top of just using the built-in SSL support (assuming a non-ancient
version of MySQL, and that it works as advertised anyway).

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 12 '07 #3
mtuller wrote:
I would like to encrypt data passed between my web server and the
database server. I have looked all over, but don't see any information
on how to connect to mysql via ssh with php. Is it possible?
Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
set up for this communication.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 13 '07 #4
I am not trying to connect via SSL, I want to tunnel through SSH.

On Sep 12, 10:26 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
mtuller wrote:
I would like to encrypt data passed between my web server and the
database server. I have looked all over, but don't see any information
on how to connect to mysql via ssh with php. Is it possible?

Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
set up for this communication.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Oct 8 '07 #5
mtuller wrote:
I am not trying to connect via SSL, I want to tunnel through SSH.

On Sep 12, 10:26 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>mtuller wrote:
>>I would like to encrypt data passed between my web server and the
database server. I have looked all over, but don't see any information
on how to connect to mysql via ssh with php. Is it possible?
Try a MySQL newsgroup, such as comp.databases.mysql. MySQL has to be
set up for this communication.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

You still need to be in a MySQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pratchaya | last post by:
What the best language code to connect MySQL --> C , C++ , php,VB,Delphi ? about ---- Speed ---- Stable ---- Security Can anyone compare C , C++ , php4,php5 ,vb ,delphi to connect to...
0
by: ryanmhuc | last post by:
I have root access to this server which has been preconfigured. I can connect using the mysql command tool. But I cannot connect using any mysql GUI software (I am currently tunneling the 3306 port...
2
by: xiuchuanli | last post by:
I install Fedora 4 with web server, after that I installed mysql 5.0.15. Now I can connect to mysql from command line and mysql-administrator and mysql-query-browser. But when I try to test to...
0
by: xiuchuanli | last post by:
I install Fedora 4 with web server, after that I installed mysql 5.0.15. Now I can connect to mysql from command line and mysql-administrator and mysql-query-browser. But when I try to test to...
1
by: shun | last post by:
Hello, I need an sample program to connect mysql server by using odbc. thanks in advance
7
nev
by: nev | last post by:
Can anyone tell me the steps how to do this or direct me to a link? I connect MySQL during runtime. I was wondering if its possible during design time so that I can use the IDE to manage all my MySQL...
3
by: likigoldenstar | last post by:
Hi, I have some problem in developing program using PHP. I 'll explain my platforms: I use appserv-win32-2.5.9 as a app server. In the server, mysql client version is 5.0.37 Problems:
3
by: rekhachaturvedi | last post by:
Hi to all. I am new in the web designing. I started using dream weaver mx 2004. I am just able to do design but not able to connect mysql. I am using apache sever. Please explain me how to connect...
2
by: vaishalinagare | last post by:
when i try to connect mysql database with vb 6.0 i got error Data source name not found and no default driver specified. i'm trying to connect remote database.
1
by: Akinyemi | last post by:
Hi, Please, how do I connect MYSQL to Eclipse? I have made several attempts but fialed. Thank you Akinyemi
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.