Tuesday, June 18, 2013

Re: Connecting to a remote database via SSH

Hi Jeremy,
i'm looking for the same solution to connect my local app dev to the online db. Question, do you have a static IP for that regarding db access limited to the IP, or do you have a solution for dynamic IP ? I have a dynamic IP ...

Best regards,
Frank

On Thursday, January 27, 2011 7:54:53 AM UTC+1, Jeremy Burns wrote:
This worked perfectly - thanks Zaky.

Jeremy Burns
Class Outfit

(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns

On 26 Jan 2011, at 07:41, Zaky Katalan-Ezra wrote:

edit /etc/ssh/sshd_config on your local machine
Add:
AllowTcpForwarding yes
GatewayPorts yes

restart sshd

Edit my.cnf on remote machine.
Uncomment the following line.
bind-address           = 127.0.0.1
restart mysql

On you local machine run the following command
ssh -i e-keypair -f remot...@remote.com -N -L 4444:localhost:3306
If you are not using ssh key you will be prompt for remote user assword

Edit database.php

var $default = array(
        'driver' => 'mysqli',
        'persistent' => false,
        'host' => '127.0.0.1',
        'port'=>4444,
        'login' => 'user',
        'password' => 'pass',
        'database' => 'schema',
        'prefix' => '',



On Wed, Jan 26, 2011 at 8:24 AM, Jeremy Burns | Class Outfit <jerem...@classoutfit.com> wrote:
I don't think I am explaining myself clearly. I am connecting to the database fine (using Sequel Pro). That is not my problem.

I want to get my local instance of a CakePHP application to connect to a remote database via SSH, so need to have the right configuration in database.php. That's where I need the guidance.
On 26 Jan 2011, at 06:20, Zaky Katalan-Ezra wrote:

1. You need port 22 and 3306 to be open on the remote server
2. Install mysql workbench
3. In the new connection form set the connection method to tcp over ssh.
4. If you are using terminal and not GUI use ssh tunnel.

And you may find more info here: http://forums.mysql.com/read.php?30,249779,249779

On Wed, Jan 26, 2011 at 7:21 AM, Jeremy Burns | Class Outfit <jerem...@classoutfit.com> wrote:
Thanks - I was hoping that someone could suggest a database.php setting that would make the connection.
On 26 Jan 2011, at 05:01, bdwilton wrote:

> Not sure if this is exactly what you had in mind, but...
>
> If you have a local work server with a local router which you can open up a port on you can use a SSH tunnel on your local work server to forward that port to a remote VPN or remote server which has its ports locked down but accessible to your IP.  This opens up the port through your router to be accessed externally but through SSH to the remote server.
>
> Just look up SSH Tunnel.
>
> Brett Wilton
> http://wiltonsoftware.com
>
> On 26/01/2011 8:32 a.m., Jeremy Burns wrote:
>> Does anyone have any ideas for how to connect to a remote database via SSH? It's a development thing so that people working remotely can develop against the same database hosted on our virtual server. --
>> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Regards,
Zaky Katalan-Ezra
QA Administrator
www.IGeneriX.com
Sites.IGeneriX.com
054-7762312

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: