Q:

Why MySQLdb for Mac has to have MySQL installed to install?

I been working on finding out how to install MySQLdb module for Python on Mac. And all pathes finally come cross to have MySQL installed since there is a mysql_config needed for the module. But I don't understand why it has to be needed? 
MySQLdb suppose to be a client module for the client who wants to connect to the server. But now I have to first install a server on the client in order to connect to another server?

A:

Just to complete the fine answers, here's a small how-to for installing MySQLdb on MacOS X 10.6. This was posted on my blog and you might check that out for maybe more info (and links as I'm a new user on stackoverflow, can only add one).

Download MySQL MacOS X 10.5 (x86_64) tar ball. For v10.5 currently, until there is one for MacOS X v10.6.
Get a copy of MySQL-python (MySQLdb).
Install the latest XCode tools found on the Snow Leopard CD under option installs or download it. You need it to compile.

I'm not covering the installation of MySQL, but when you've done so, here's how you install MySQLdb.
shell> PATH="/usr/local/mysql/bin:$PATH"
shell> tar xzf MySQL-python-1.2.3c1.tar.gz
shell> cd MySQL-python-1.2.3c1
shell> ARCHFLAGS="-arch x86_64" /usr/bin/python setup.py build
shell> /usr/bin/python setup.py install

There is currently work done on MySQL Connector/Python. The is a pure Python implementation of the MySQL protocol so you don't need to install any MySQL software or compile to get you going.

A:

MySQLdb is not a client module per se.  It is a wrapper or interface between Python programs and the standard MySQL client libraries. MySQLdb conforms to the Python standard DB API. There are other conforming adapters implemented for other database managers.  Using the common API makes it much easier to write database-independent code in Python; the adapters handle (much of) the messy differences among the various database client libraries.  Thus, you do need to install MySQL client libraries; there are several ways to do this: the easiest options are probably downloading prebuilt libraries from mysql.com or you can use a package manager, like MacPorts, to install them and other dependencies.

