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
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-10-2008, 10: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, 10:53 AM   #2 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
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 :)
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 07-10-2008, 11:21 AM   #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, 11:24 AM   #4 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
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.
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 07-10-2008, 11:34 AM   #5 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

this may be of some use: http://chxo.com/be2/20040511_5667.html
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 08:15 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design