Forums

Unknown MySQL Host from Python

I have copied my old data to the pythonanywhere. It look ok as SQL queries from mySQL console work. Python script is failing. My Hostname is ABB.mysql.pythonanywhere-services.com in Python This is what is set for MYSQLHOST=' ABB.mysql.pythonanywhere-services.com' The database name is ABB$default

Python MySQLdb.connect returns error

mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host ' ABB.mysql.pythonanywhere-services.com' (11)")

What is wrong here?

the host for your the current PythonAnywhere account you are logged in to should be qunal.mysql.pythonanywhere-services.com. Where are you seeing it being ABB.mysql.pythonanywhere-services.com?

Also- from your current account, it seems like you have not started a MySQL database yet- go to the databases tab to create one (eg: qunal$default)

I was illustrating. Solved . There was a extra space character in the server name.