update: Problem solved, solution posted below
I am new to the process of making remote database connections, but it seems that there tends not to be an obvious solution for this error.
pymysql.err.InternalError: Packet sequence number wrong - got 80 expected 0
arises when attempting to make the following pymysql connection
I'm running MacOS 10.12.5, Python 2.7.10 in PyCharm (also tried with Terminal), and PyMySQL 0.7.11 (also tried 0.7.9)
update: also tried on Windows 10, Python 2.7.13 with the same result
The database is hosted on cPanel. Perhaps there are additional settings to change before I can connect. The connecting user has full privileges. My IP was added to the host "access" list.
other notes: As might be expected, if the port number or host IP is randomly changed, it immediately refuses the connection. Otherwise, it takes about 30 seconds before the 'packet sequence' error to arise.
import pymysql.cursors
import pymysql
connection = pymysql.connect(host = hostIPaddress,
port = 2083,
user = username,
passwd = password,
db = dbName,
charset = 'utf8mb4', # also tried 'utf8'
cursorclass=pymysql.cursors.DictCursor)