SSHTunnelForwarder ( ( 'your SSH hostname' ), ssh_username = 'your PythonAnywhere username', ssh_password = 'the password you use to log in to the PythonAnywhere website', remote_bind_address = ( 'your PythonAnywhere database hostname, eg.
#Connecting mysql database using python on mac install#
Your MySQL database, you can install the sshtunnel packageĪnd then use code like this: import MySQLdb import sshtunnel sshtunnel. If you're running Python code on your local machine, and you want it to access Your SSH hostname (ssh.eu. or )ģ306 if you are not running a local database, else a random number you pick
If your account is on our global, US-based system at then the SSH hostname is.However, if you have a paid account, you can access your MySQL databaseįrom outside using a technique called an SSH tunnel, which essentially makesĪ secure SSH connection to our systems, then sends the MySQL stuff over it. MySQL databases on PythonAnywhere are protected by a firewall, so external Warning - this will only work in paid accounts