Access MySQL db from python

It's simpler than I expect.

>>> import MySQLdb
>>> db = MySQLdb.connect("server ip", "username", "password", "db name")
>>> cursor = db.cursor()
>>> cursor.execute("sql statement")
>>> data = cursor.fetchone()

留言

這個網誌中的熱門文章

Google Phone跟iPhone的比較!?

我第一個Android程式上架了...