mysqldb - MySQL support for Python ChangeLog

HOWTO


# MySQLdb (MySQL-Python)
# ======================
# Below we cover MySQLdb and anything that it uses like mxDateTime

# This used to be part of my viewcvs howto, if you have an old version that
# was installed from it, this will clean it up
cd
test -d installed/viewcvs &&
( find installed/viewcvs -maxdepth 1 -type f -name "MySQL-python-*.tar.*" \
    -exec rm {} \;
   find installed/viewcvs -maxdepth 1 -type f \
    -name "egenix-mx-base-*.tar.*" -exec rm {} \; )
test -d src/viewcvs &&
( find src/viewcvs -maxdepth 1 -type d -name "MySQL-python-*" \
    -exec rm -r {} \;
   find src/viewcvs -maxdepth 1 -type d -name "egenix-mx-base--*" \
    -exec rm -r {} \; )
#
# and run this as root (with su)
su -c "
find /usr/lib/python*/site-packages -maxdepth 1 -type d \
-name MySQLdb -exec rm -r {} \;
find /usr/lib/python*/site-packages -maxdepth 1 -type f \
-name "_mysql*" -exec rm {} \;
test -d /usr/lib/python2.4/site-packages/mx &&
rm -r /usr/lib/python2.4/site-packages/mx
"


# mxDateTime 3.2.6
# ==========
# This will get you the whole eGinix.com mx Base distribution:
# mxDateTime, mxTextTools, mxProxy, etc.

# Prerequisites:
# Python >= 2.1

cd
test -f installed/viewcvs/egenix-mx-base-3.2.6.tar.gz &&
mv installed/viewcvs/egenix-mx-base-3.2.6.tar.gz .
test ! -f egenix-mx-base-3.2.6.tar.gz &&
wget http://downloads.egenix.com/python/egenix-mx-base-3.2.6.tar.gz
cd src
find -maxdepth 1 -type d -name "egenix-mx-base-*" -exec rm -r {} \;
tar xzvf ~/egenix-mx-base-3.2.6.tar.gz
cd egenix-mx-base-3.2.6
test $UID = 0 && chown -R root:root .
python setup.py build
su -c "python setup.py install"
cd
rm -f installed/egenix-mx-base-*.tar.*
mv egenix-mx-base-3.2.6.tar.gz installed/


# MySQLdb 1.2.3
# =============
# Prerequisites (beyond those listed above):
# Python >= 2.3.4
# distutils >= 1.0.2 (which comes with python as of python 2.1)
# MySQL >= 3.23.32
# zlib
# setuptools

# Get the new version
cd
test -f installed/MySQL-python-1.2.3.tar.gz &&
mv installed/MySQL-python-1.2.3.tar.gz .
test ! -f MySQL-python-1.2.3.tar.gz &&
wget http://downloads.sf.net/mysql-python/MySQL-python-1.2.3.tar.gz

# Extract the tarball
cd src
find -maxdepth 1 -type d -name "MySQL-python-*" -exec rm -r {} \;
tar xzvf ~/MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
test $UID = 0 && chown -R root:root .

# If you do not have the thread-safe mysqlclient_r library (check
# /usr/local/mysql/lib/mysql or /usr/lib if it's not under
# /usr/local/mysql), open up site.cfg in a text editor and change
# threadsafe to False.

# Build it
python setup.py build

# Become root
su

# Make sure the MySQL bin directory is in your PATH so the install script
# can find mysql_config.  If you have a distribution-installed MySQL,
# you're probably fine, it will be in /usr/bin.
test -f /etc/profile.d/mysql.sh && . /etc/profile.d/mysql.sh

# If you don't have a /etc/profile.d/mysql.sh
test -d /usr/local/mysql &&
( echo $PATH | grep -q "/usr/local/mysql/bin" ||
   PATH=$PATH:/usr/local/mysql/bin )

# Install it
python setup.py install

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# Save the source for later
cd
rm -f installed/MySQL-python-*.tar.*
mv MySQL-python-1.2.3.tar.gz installed/

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EDT -0400)
HOWTO last updated: 2013-08-27 1:03am
Copyright © 2001-2024 Jason Englander. All Rights reserved.
[HTML5]