title: How connect to mysql with python via odbc
body: <p>Im  running mysql, pyodbc, python 2.7 loaded on Fedora 14 x64. </p>
  
  <p>Odbcinst.ini is: </p>
  
  <pre><code># Example driver definitions
  
  # Driver from the postgresql-odbc package
  # Setup from the unixODBC package
  #[PostgreSQL]
  #Description    = ODBC for PostgreSQL
  #Driver     = /usr/lib/psqlodbc.so
  #Setup      = /usr/lib/libodbcpsqlS.so
  #Driver64   = /usr/lib64/psqlodbc.so
  #Setup64    = /usr/lib64/libodbcpsqlS.so
  #FileUsage  = 1
  
  
  # Driver from the mysql-connector-odbc package
  # Setup from the unixODBC package
  [MySQL]
  Description = ODBC for MySQL
  #Driver     = /usr/lib/libmyodbc5.so
  #Setup      = /usr/lib/libodbcmyS.so
  Driver64    = /usr/lib64/libmyodbc5.so
  Setup64     = /usr/lib64/libodbcmyS.so
  FileUsage   = 1
  </code></pre>
  
  <p>Odbc.ini is : </p>
  
  <pre><code>[MySQL]
  Driver = MySQL
  Database = mysql
  Server = localhost
  Socket = /var/lib/mysql/mysql.sock
  User = rooter
  Password = sshh
  </code></pre>
  
  <p>Mysql.sock is empty? 
  /var/lib/mysql/mysql.sock has 0.B</p>
  
  <p>python script is:  </p>
  
  <pre><code>import pyodbc
  
  #pyodbc.pooling = False 
  conn = pyodbc.connect('DRIVER={MySQL};SOCKET=/var/lib/mysql/mysql.sock;UID=rooter;PWD=sshh') 
  
  csr = conn.cursor()
  csr.execute("SET GLOBAL event_scheduler = ON")
  csr.close()
  
  conn.close() 
  del csr
  </code></pre>
  
  <p>I cant seem to connect with above script, Using isql i get Connected! </p>
  
  <p>MyERROR msg:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/CCX/Py/MySql Event OFF.py", line 4, in &lt;module&gt;
      conn = pyodbc.connect('DRIVER={MySQL};SOCKET=/var/lib/mysql/mysql.sock;UID=rooter;PWD=sshh') 
  pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnectW)')
  </code></pre>
  
  <p>On Win XPx64, </p>
  
  <pre><code>#cxn = MySQLdb.connect (host = "localhost",user="rooter",passwd ="sshh")
  </code></pre>
  
  <p>Err Msg:  </p>
  
  <pre><code>File "C:\Python26\lib\site-packages\MySQLdb\__init__.py", line 19, in &lt;module&gt;
      import _mysql
  ImportError: DLL load failed: %1 is not a valid Win32 application.
  </code></pre>