I have read and re-read past forum questions and still get the same, familiar error in connecting to MySQL from Python 3.6 running a Flask application:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Here is my Flask connection method where yes, I am using ALL parameters from the Databases tab. Password even reflects what is in the my.cnf file. I even copied and pasted directly from Databases tab in case I misspelled to no avail.
import MySQLdb
...
def connection():
dbconn = MySQLdb.connect(host = "myusername.mysql.pythonanywhere-services.com",
user = "myusername",
passwd = "******",
db = "myusername$mydatabasename")
cur = dbconn.cursor()
return (cur, dbconn)
I have tried different port (3306 and nothing); different host (mysql.server, localhost, 127.0.0.1) to no avail. PA online help pages only show Django connections.
Does the server need time to propogate changes? Is the mysql service running and can it be restarted? Please advise on issue. Thanks!