On Fri, Mar 26, 2010 at 09:32:35AM +0800, Christopher Chan wrote:
Where'd you get your MySQLdb module from?
yum install MySQL-python
Well, don't know what to tell you:
$ rpm -qi MySQL-python Name : MySQL-python Relocations: (not relocatable) Version : 1.2.1 Vendor: CentOS Release : 1 Build Date: Fri 05 Jan 2007 08:40:16 PM PST Install Date: Thu 25 Mar 2010 06:35:52 PM PDT Build Host: builder1.centos.org Group : Development/Libraries Source RPM: MySQL-python-1.2.1-1.src.rpm Size : 283388 License: GPL Signature : DSA/SHA1, Tue 03 Apr 2007 05:25:09 PM PDT, Key ID a8a447dce8562897 URL : http://sourceforge.net/projects/mysql-python/ Summary : An interface to MySQL Description : Python interface to MySQL
MySQLdb is an interface to the popular MySQL database server for Python. The design goals are:
- Compliance with Python database API version 2.0 - Thread-safety - Thread-friendliness (threads will not block each other) - Compatibility with MySQL 3.23 and up
$ python Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import MySQLdb conn = MySQLdb.connect(user='rayvd', passwd='XXXXXX', db='bludgeon') cursor=conn.cursor() cursor.execute("SELECT * FROM quotes LIMIT 1")
1L
results = cursor.fetchone()
Ray