-
Notifications
You must be signed in to change notification settings - Fork 448
PythonMysql
Various BOINC tools depend on a Python extension module called "MySQLdb". You can get the source on mysql-python sourceforge project.
WARNING: currently (2003/08/28) BOINC requires version 0.9.2 of Python-MySQLdb, however this could be backported to 0.9.1 in the future as many Linux distributions seem to have 0.9.1.
Lines beginning with "$" indicate example commands to type in bourne shell.
Lines beginning with "#" indicate example commands to type with write access to the install location (i.e. su or sudo)
Lines beginning with ">>> " indicate example commands to type in Python.
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
.
- Install
# apt-get install python-mysqldb
If you have multiple Python versions installed you may want to do
# apt-get install python2.2-mysqldb
or
# apt-get install python2.3-mysqldb
- Download MySQL-python
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python2-0.9.2-1.i386.rpm
- Install
# rpm -i MySQL-python2-0.9.2-1.i386.rpm
- Download MySQL-python
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
- Unpack
$ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
- Build
$ cd MySQL-python-0.9.2
$ python setup.py build
- Install
# python setup.py install
- Download MySQL-python
$ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
- Unpack
$ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
- Download Python
$ wget http://python.org/ftp/python/2.3/Python-2.3.tgz
- Unpack
$ gunzip -c Python-2.3.tgz | tar xf -
- Copy MySQL files
$ cp MySQL-python-0.9.2/{*.c,*.h} Python-2.3/Modules/
$ cp MySQL-python-0.9.2/_mysql_exceptions.py Python-2.3/Lib/
$ cp -r MySQL-python-0.9.2/MySQLdb Python-2.3/Lib/
- Enter the MySQL module in the Python extension setup file.
$ cd Python-2.3/
$ perl -wpi.bak -e "s,^_sre _sre.c,_mysql _mysql.c `mysql_config --cflags` `mysql_config --libs`\n$&," Modules/Setup
(This adds the line '_mysql _msql.c [flags]' to Modules/Setup)
$ perl -wpi.bak -e 's,^LIBSUBDIRS=\s+,$&MySQLdb ,' Makefile.pre.in
(This adds MySQLdb to the list of libraries to install)
- Configure python
$ cd Python-2.3/
$ ./configure --prefix=/usr/local
or whatever path you want instead of /usr/local]
- Build
$ make
Troubleshooting:
If you get undefined symbols or other compile errors in _mysql.c
you probably didn't add the correct include directory for mysql. If you get unresolved symbols or other link errors involving _mysql.o
or libmysql.a
you probably didn't add the correct libraries.
You may want to check Python and MySQLdb are working before installing by running ./python; see below for instructions.
- Install
$ cd ../Python-2.3/
# make install
You can check if your Python and/or MySQLdb was compiled and installed correctly like this:
$ python
>>> import MySQLdb
>>> MySQLdb.version_info
>>> MySQLdb.connect(db='databasename', user='username', passwd='userpassword')