Changes between Initial Version and Version 1 of PythonMysql


Ignore:
Timestamp:
Apr 24, 2007, 1:31:58 PM (18 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PythonMysql

    v1 v1  
     1{{{
     2Various BOINC tools depend on a Python extension module called "MySQLdb".  You
     3can get the source here:
     4
     5http://sourceforge.net/projects/mysql-python
     6
     7WARNING: currently (2003/08/28) BOINC requires version 0.9.2 of
     8Python-MySQLdb, however this could be backported to 0.9.1 in the future as
     9many Linux distributions seem to have 0.9.1.
     10
     11
     12INSTALLATION INSTRUCTIONS
     13=========================
     14
     15Lines beginning with "$" indicate example commands to type in bourne shell.
     16
     17Lines beginning with "#" indicate example commands to type with write access
     18to the install location (i.e. su or sudo)
     19
     20Lines beginning with ">>> " indicate example commands to type in Python.
     21
     22The `shared module' options build a shared library for the Python-MySQLdb
     23module that is loaded at Python run-time.  This requires that you have a
     24shared version of the MySQL client library installed, i.e. libmysqlclient.so.
     25
     26Debian Linux: shared module
     27---------------------------
     28    1. Install
     29       # apt-get install python-mysqldb
     30   
     31    [ 2003/07: if you have multiple Python versions installed you may want to do
     32       # apt-get install python2.2-mysqldb
     33            or
     34       # apt-get install python2.3-mysqldb
     35    ]
     36
     37Red Hat Linux: shared module
     38----------------------------
     39    1. Download MySQL-python
     40       $ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python2-0.9.2-1.i386.rpm
     41
     42    2. Install
     43       # rpm -i MySQL-python2-0.9.2-1.i386.rpm
     44
     45Other Unix/Linux: shared module
     46-------------------------------
     47    1. Download MySQL-python
     48       $ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
     49
     50    2. Unpack
     51       $ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
     52
     53    3. Build
     54       $ cd MySQL-python-0.9.2
     55       $ python setup.py build
     56
     57    4. Install
     58       # python setup.py install
     59
     60Unix/Linux: compiled statically into Python
     61-------------------------------------------
     62    1. Download MySQL-python
     63       $ wget http://easynews.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-0.9.2.tar.gz
     64
     65    2. Unpack
     66       $ gunzip -c MySQL-python-0.9.2.tar.gz | tar xf -
     67
     68    3. Download Python
     69       $ wget http://python.org/ftp/python/2.3/Python-2.3.tgz   
     70
     71    4. Unpack
     72       $ gunzip -c Python-2.3.tgz | tar xf -
     73
     74    5. Copy MySQL files
     75       $ cp MySQL-python-0.9.2/{*.c,*.h} Python-2.3/Modules/
     76       $ cp MySQL-python-0.9.2/_mysql_exceptions.py Python-2.3/Lib/
     77       $ cp -r MySQL-python-0.9.2/MySQLdb Python-2.3/Lib/
     78
     79    8. Enter the MySQL module in the Python extension setup file.
     80       $ cd Python-2.3/
     81       $ perl -wpi.bak -e "s,^_sre _sre.c,_mysql _mysql.c `mysql_config --cflags` `mysql_config --libs`\n$&," Modules/Setup
     82           (This adds the line '_mysql _msql.c [flags]' to Modules/Setup)
     83
     84       $ perl -wpi.bak -e 's,^LIBSUBDIRS=\s+,$&MySQLdb ,' Makefile.pre.in
     85           (This adds MySQLdb to the list of libraries to install)
     86
     87    7. Configure python
     88       $ cd Python-2.3/
     89       $ ./configure --prefix=/usr/local
     90        [or whatever path you want instead of /usr/local]
     91
     92    8. Build
     93       $ make
     94
     95       Troubleshooting:
     96           If you get undefined symbols or other compile errors in
     97           _mysql.c you probably didn't add the correct include
     98           directory for mysql. If you get unresolved symbols or other
     99           link errors involving _mysql.o or libmysql.a you probably
     100           didn't add the correct libraries.
     101
     102       You may want to check Python and MySQLdb are working before installing
     103       by running ./python; see below for instructions.
     104
     105    9. Install
     106       $ cd ../Python-2.3/
     107       # make install
     108
     109Windows: pre-built binary
     110-------------------------
     111    There is a built python executable available at the URL listed.
     112
     113Does it work?
     114=============
     115    You can check if your Python and/or MySQLdb was compiled and installed
     116    correctly like this:
     117   
     118    $ python
     119    >>> import MySQLdb
     120    >>> MySQLdb.version_info
     121    >>> MySQLdb.connect(db='databasename', user='username')
     122}}}