TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Display Modes
Old 07-10-2008, 11:21 AM   #1 (permalink)
The Visitor
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
yusufeen is on a distinguished road
Default MySQL database connection with help of SSH tunneling

Hello All,

I would like to connect MySQL database from PHP, with help of SSH tunneling. I suppose/want to use "ssh2_connect" and "ssh2_..." sets of commands.

Queries are that can I use these sets of command for this purpose, and if yes how can I do that.

Thanks in advance.

Regards,
yusufeen is offline  
Reply With Quote
Old 07-10-2008, 11:53 AM   #2 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 224
Thanks: 2
Jim is on a distinguished road
Default

Well, to login to your mysql demon from ssh cli you use the following command:

> mysql -u username -p
> password

And you are now able to use the mysqld from ssh. You use "quit" to stop using the server.

But may I ask why you want to do it over ssh?

As for the ssh2_* functions, never used them so I can't help you with that :)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 07-10-2008, 12:21 PM   #3 (permalink)
The Visitor
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
yusufeen is on a distinguished road
Default

Quote:
Originally Posted by Jim View Post
As for the ssh2_* functions, never used them so I can't help you with that :)
Are you sure we cannot able to connect mysql from PHP with the help of ssh2_* ? My main query is based on that. I really would like to know that if this is possible or not ?
yusufeen is offline  
Reply With Quote
Old 07-10-2008, 12:24 PM   #4 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 224
Thanks: 2
Jim is on a distinguished road
Default

Well if you can connect to ssh you should be able to use mysql. But it would be pretty difficult to use compared with the normal mysql functions.
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 07-10-2008, 12:34 PM   #5 (permalink)
The Frequenter
Advanced Programmer Top Contributor Good Samaritan 
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 469
Thanks: 26
sketchMedia is on a distinguished road
Default

this may be of some use: http://chxo.com/be2/20040511_5667.html
__________________
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:43 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0