2003-07-31 22:33:11 +00:00
|
|
|
;; $Id$
|
|
|
|
|
|
|
|
To run the test scripts in test/ you need a Python extension module called
|
|
|
|
"MySQLdb". You can get the source here:
|
|
|
|
|
|
|
|
http://sourceforge.net/projects/mysql-python
|
|
|
|
|
|
|
|
INSTALLATION INSTRUCTIONS
|
|
|
|
=========================
|
|
|
|
|
|
|
|
Lines beginning with "$" indicate example commands to execute the instructed
|
|
|
|
step.
|
|
|
|
|
2003-07-31 22:40:55 +00:00
|
|
|
The `shared module' options build a shared library for the Python-MySQLdb
|
|
|
|
module that is loaded at Python run-time. This requires that you have a
|
|
|
|
shared version of the MySQL client library installed, i.e. libmysqlclient.so.
|
2003-07-31 22:33:11 +00:00
|
|
|
|
|
|
|
Debian Linux: shared module
|
2003-07-31 22:40:55 +00:00
|
|
|
---------------------------
|
|
|
|
1. Install
|
|
|
|
$ apt-get install python-mysqldb
|
|
|
|
|
|
|
|
[ 2003/07: if you have both Python 2.1 and 2.2 installed and use python2.2, do
|
|
|
|
$ apt-get install python2.2-mysqldb
|
|
|
|
]
|
|
|
|
|
|
|
|
Red Hat Linux: shared module
|
|
|
|
----------------------------
|
|
|
|
1. Download MySQL-python
|
|
|
|
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2-1.i386.rpm
|
|
|
|
2. Install
|
|
|
|
$ rpm (arguments?)
|
2003-07-31 22:33:11 +00:00
|
|
|
|
|
|
|
Other Unix/Linux: shared module
|
2003-07-31 22:40:55 +00:00
|
|
|
-------------------------------
|
|
|
|
1. Download MySQL-python
|
|
|
|
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
|
|
|
|
2. Unpack
|
|
|
|
$ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
|
|
|
|
$ cd MySQL-python-0.9.2
|
|
|
|
3. Build
|
|
|
|
$ python setup.py build
|
|
|
|
4. Install
|
|
|
|
$ python setup.py install
|
2003-07-31 22:33:11 +00:00
|
|
|
|
|
|
|
Unix/Linux: compiled statically into Python
|
2003-07-31 22:40:55 +00:00
|
|
|
-------------------------------------------
|
|
|
|
1. Download MySQL-python
|
|
|
|
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
|
|
|
|
2. Unpack
|
|
|
|
$ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
|
|
|
|
3. Download Python
|
|
|
|
$ wget http://python.org/ftp/python/2.3/Python-2.3.tgz
|
|
|
|
4. Unpack
|
|
|
|
$ gunzip -c Python-2.3.tgz | tar xf -
|
|
|
|
$ cd Python-2.3
|
|
|
|
5. Copy MySQL files
|
|
|
|
$ cp ../MySQL-python-0.9.2/{*c,*.h} Modules/
|
|
|
|
6. Configure python
|
|
|
|
$ ./configure --prefix=/path/to/install/python
|
|
|
|
7. Modify the Python module setup file.
|
|
|
|
$ vi Modules/Setup
|
|
|
|
|
|
|
|
Find 'sre _sre.c' and add below it:
|
|
|
|
_mysql _mysql.c -I/usr/include/mysql -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient
|
|
|
|
|
|
|
|
If those -I and -L flags don't work you can find the correct ones using
|
|
|
|
the program `mysql_config'
|
|
|
|
8. Build
|
|
|
|
$ make
|
|
|
|
9. Install
|
|
|
|
$ make install
|
2003-07-31 22:33:11 +00:00
|
|
|
|
|
|
|
Windows: pre-packaged binary
|
2003-07-31 22:40:55 +00:00
|
|
|
----------------------------
|
|
|
|
There is a built python executable available at the URL listed.
|
2003-07-31 22:33:11 +00:00
|
|
|
|
|
|
|
Does it work?
|
|
|
|
=============
|
2003-07-31 22:40:55 +00:00
|
|
|
You can check if your MySQLdb was installed correctly like this:
|
|
|
|
|
|
|
|
$ python
|
|
|
|
>>> import MySQLdb
|
|
|
|
>>> MySQLdb.connect(db='databasename', user='username')
|