I am trying to connect to MYSQl db Server using pyodbc module.
with pyodbc.connect('DRIVER={MySQL ODBC 5.6 Driver};SERVER=XX.XX.X.XX;PORT=3306;DATABASE=ssc;UID=Pra;PASSWORD=welcome;') as cnxn:
cursor = cnxn.cursor()
cursor.execute('insert into ....')
When I ran the above code in python I am encountering an error 'local variable 'cnxn' referenced before assignment'I am working on MySQL workbench 6.2 and I am not sure which version of MySQL driver to use.