CodeIgniter Forums
Connect to database over SSH - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Connect to database over SSH (/showthread.php?tid=12329)



Connect to database over SSH - El Forum - 10-15-2008

[eluser]Martin Rusev[/eluser]
Hi all,

I have the following problem. My Codeigniter application is build and hosted on Server 1.
Server 1 doesn't have Database installed. The only way to use database in my application is to connect remotely to Server 2 via SSH.

My question is : Is it possible to do this in Codeigniter or I must add additional libraries?

Thank you in advance for your time and attention Smile


Connect to database over SSH - El Forum - 10-15-2008

[eluser]johnwbaxter[/eluser]
You'll have to do a fair amount of this outside CI as there is no ssh lib or anything like that.

Shouldn't be too hard though.


Connect to database over SSH - El Forum - 10-15-2008

[eluser]sensimevanidus[/eluser]
What does "using a database by connecting remotely to Server2 via SSH" means? I couldn't understand your saying frankly. Does this mean that you can only connect locally to the database found on the Server2, not remotely?


Connect to database over SSH - El Forum - 10-15-2008

[eluser]Martin Rusev[/eluser]
I am sorry if they are any misunderstandigs :0

My application is on Server 1, database on Server 2.

That means - I have to connect to Server 2 via SSH and then using that tunnel connection, to use the installed there mysql server for my application on Server 1


Connect to database over SSH - El Forum - 10-15-2008

[eluser]Tom Glover[/eluser]
[quote author="Martin Rusev" date="1224094776"]I am sorry if they are any misunderstandigs :0

My application is on Server 1, database on Server 2.

That means - I have to connect to Server 2 via SSH and then using that tunnel connection, to use the installed there mysql server for my application on Server 1[/quote]

Can't you tell MySQL on Server two to allow connections from Server one, this is remote server connections.


Connect to database over SSH - El Forum - 10-15-2008

[eluser]Martin Rusev[/eluser]
It works Smile

Thank you very much


Connect to database over SSH - El Forum - 10-15-2008

[eluser]Tom Glover[/eluser]
[quote author="Martin Rusev" date="1224099910"]It works Smile

Thank you very much[/quote]

No Problem, are you using remote MySQL Connections?


Connect to database over SSH - El Forum - 10-15-2008

[eluser]Martin Rusev[/eluser]
I used this:

http://dev.mysql.com/doc/refman/5.0/en/connection-access.html

and then i just changed the "host" value in database.php in my Codeigniter application.