pyodbc and mySQL

后端 未结 6 1367
死守一世寂寞
死守一世寂寞 2021-01-05 17:30

I am unable to connect to mySQl db using pyodbc.

Here is a snippet of my script:

import pyodbc
import csv

cnxn = pyodbc.connect(\"DRIVER={MySQL ODBC         


        
6条回答
  •  走了就别回头了
    2021-01-05 17:45

    First, According to the official docs, if you want to connect without creating a DSN, you need to specify OPTION=3 in the connection string:

    ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=venu;PASSWORD=venu;OPTION=3;"
    

    If that fails to work, I'd further troubleshoot by creating a DSN.

    Second, no Python should not be failing silently. If that is the case when you run your script, there is something else amiss.

提交回复
热议问题