Forums

Accessing Databases via GitHub Codespaces

I am attempting to access my python anywhere database via the Visual Studio Code interface in GitHub Codespaces. I have tried to use the following configuration:

tunnel = sshtunnel.SSHTunnelForwarder(
(py_anywhere_ssh_host),
ssh_username=user_name, 
ssh_password=py_anywhere_ssh_password,
remote_bind_address=py_anywhere_remote_bind
)
tunnel.start()

connection = mysql.connector.connect(
host = '127.0.0.1',
database = py_anywhere_db,
user = user_name,
password = py_anywhere_password,
port=tunnel.local_bind_port,
use_pure=True,
)

and am receiving the error:

AssertionError: UNIX domain sockets not allowed for remoteaddresses

The remote bind address being used is (‘username. mysql.pythonanywhere-services.com', 3306)

You will need to check the Github documentation to see if they support connecting to databases through SSH tunnels.