Reputation: 1271
We have a Python script that writes values to a local database. We need to move this database to a remote host that requires the connection come from a white-listed IP address, which we have to set and forget.
Our solution is to use the proxy from another part of the Python sctipt (HTTP GET for something else). However, the MySQLDB library doesn't seem to allow for a proxy connection with authentication.
Our question... Are there any other librarys available, or perhaps another library or a MySQL solution to achieve this?
We found this but it's not much to go on, and doesn't seem to work. Note we can't use a system wide proxy.
TLDR: How can you connect to a MySQL Database via a proxy to solve a problem of needing to be connected through a static IP?
Upvotes: 1
Views: 7161
Reputation: 1457
I don't know what type of solution do you need; permanent or temporary.
But you can use ssh
with -L
switch.
ssh -L3307:localhost:3306 root@mysqlserver
now you can connect to port 3307 on your local computer. You should define host
and set it 127.0.0.1
Upvotes: 5