Thanks, Richard. It worked.

The command I used was:
ssh linux_user@ip_address -L 3307:database_ip:3306

(Our database is hosted on Amazon RDS, so for us ip_address was different
from database_ip. )

Our connection string was:

'mysql://user:password@localhost:3307/database_name'


Thanks again!


On Fri, Feb 15, 2013 at 9:27 AM, Richard Vézina <[email protected]
> wrote:

> Better use SSH with port fowarding...
>
> Something like that in terminal :
>
> ssh -L3307:localhost:3306 linux_user@ip_address
>
> Then you should be able to use this connection string :
>
> db=DAL('mysql://user:[email protected]:3307/database', ...)
>
> Not tested...
>
> Richard
>
>
> On Thu, Feb 14, 2013 at 6:08 PM, Osman Masood <[email protected]> wrote:
>
>> Hi,
>> I'm trying to connect get web2py to connect to MySQL via SSL (or SSH).
>> Based on the code, seems like I need to do something like:
>>
>> db = DAL('..',
>> driver_args=dict(ssl=dict(ca='/path/to/mysql-ssl-ca-cert.pem')))
>>
>> (I only need the CA cert file, the key and certificate files are not
>> needed for the connection.)
>>
>> It works through my SQL client (Sequel Pro), but not through web2py.
>> Anyone have any ideas? It gives me the following error message:
>>
>> <type 'exceptions.RuntimeError'> Failure to connect, tried 5 times:
>> Traceback (most recent call last): File
>> "/Users/oamasood/src/web2py/gluon/dal.py", line 6853, in __init__
>> self._adapter = ADAPTERS[self._dbname](**kwargs) File
>> "/Users/oamasood/src/web2py/gluon/dal.py", line 2402, in __init__ if
>> do_connect: self.reconnect() File
>> "/Users/oamasood/src/web2py/gluon/dal.py", line 576, in reconnect
>> self.connection = f() File "/Users/oamasood/src/web2py/gluon/dal.py", line
>> 2400, in connector return self.driver.connect(**driver_args) File
>> "/Users/oamasood/src/web2py/gluon/contrib/pymysql/__init__.py", line 93, in
>> Connect return Connection(*args, **kwargs) File
>> "/Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py", line
>> 575, in __init__ self._connect() File
>> "/Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py", line
>> 741, in _connect self._request_authentication() File
>> "/Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py", line
>> 796, in _request_authentication self._send_authentication() File
>> "/Users/oamasood/src/web2py/gluon/contrib/pymysql/connections.py", line
>> 822, in _send_authentication self.socket =
>> ssl.wrap_self.socketet(self.socket, keyfile=self.key, AttributeError:
>> 'module' object has no attribute 'wrap_self'
>>
>>
>> Thanks,
>> Osman
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to