Forums

Connecting to MySQL in remotemysql.com

I use remotemysql.com to host a MySQL database which is used for my spigot project.

Here's is an example (Note that password is not real)

HOST = 'remotemysql.com'
USER = 'AGMHEADCOLLECTION'
PASS = 'PASSWORD'
_DB_ = 'COLLECTION'

import mysql.connector

print("Connecting to server ...")
db = mysql.connector.connect(host=HOST,user=USER,passwd=PASS,db=_DB_)
cur = db.cursor()
print("Connected")

It doesn't connect, unfortunately. As I know this website doesn't share anything except a MySQL server. Can you open a connection to this site?

We've been corresponding over email too, so you already know the answer to this, but I'll post here as well so that other people who are reading the forums know the answer :-)

Free accounts on PythonAnywhere can only make outbound HTTP and HTTPS connections, and can only connect to sites on our whitelist. Unfortunately MySQL uses its own protocol, not based on HTTP or HTTPS, so we can't whitelist MySQL servers.