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. 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
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |