How To Set Up Maya 8.5 And Python Mysqldb

I saw a post about this previously… I got MySQL connectivity working in Maya 8.5 with python on Win32.

Here’s how I did it:

  1. found out that Maya 8.5 uses the python 2.4 interpreter
  2. downloaded the MySQLdb connector from SourceForge: http://sourceforge.net/project/showfiles.php?group\_id=22307
    (make sure you grab the Python 2.4 build, “MySQL-python-1.2.2.win32-py2.4.exe”)
  3. The file you download is a self-extracting archive. I used WinRar to uncompress it to a temporary location
  4. Copy the uncompressed files to the “\Maya8.5\Python\lib\site-packages” directory
  5. Start Maya and run some test code via Python:

dbh = MySQLdb.connect(host = “localhost”, user = “root”, passwd = “thePassword”, db = “someDatabase”)
sth = dbh.cursor()
sth.execute (“SELECT NOW()”)
row = sth.fetchone()
print "it is ", row[0]
sth.close()
dbh.close()

For Maya on Win64, you’ll probably have to find a build of MySQLdb for Win64, or compile it yourself. Use gcc on
Cygwin (for example)

…xelA

Indeed I have also setup PostgreSQL & MSSql connections from maya. A very sweet python wrapper for sql is http://www.sqlalchemy.org/ Check it out.
Python defiantly makes project management possible inside of maya.