

You can install on your machine with pip install mysqlclient This example uses the mysqlclient library, which local_bind_port, db = 'your database name, eg yourusername$mydatabase', ) # Do stuff connection. connect ( user = 'your PythonAnywhere database username', passwd = 'your PythonAnywhere database password', host = '127.0.0.1', port = tunnel. ', 3306 ) ) as tunnel : connection = MySQLdb. 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.
Psequel when to check ssl box code#
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 Check "Use SSH tunnel" in Connect to new database -> Mysql -> SSH tab.If you're running DBeaver, you can configure it with the following settings: It's also a good idea to set the Edit -> Preferences -> SQL Editor -> DBMS_Connection keep alive interval setting to 200, to avoid any "lost connection" issues due to our 5-minute connection timeout. You may also need to allow ssh login based management as one of the mysql workbench options under server connections -> remote management. Your database name, eg yourusername$mydatabase Your PythonAnywhere database hostname, eg. Should not be necessary when you specify the password The password you use to log in to the PythonAnywhere website If you're running MySQL Workbench, you can configure it with settings like this using "Standard TCP/IP over SSH": Setting Īrmed with that, you can do one of the following: MySQL Workbench ¶ Note the difference in hostnames for both SSH and MySQL: Hostname If your account is on our EU-based system at eu., then the SSH hostname is ssh.eu.

