Step 1: Install mysql-python-1.2.2.tar
Python setup. py build
Python setup. py intstall
Step 2: Possible Errors
1. libmysqlclient. so.16: cannot open shared object file: No such file or directory
Need to install a new package mysqlclient16-5.1.30-1.el5.remi.i386
Or set the link through ln-s.
2, in the build need to follow the setuptools-0.6b1-py2.4.egg package
% Wget-q http://peak.telecommunity.com/dist/ez_setup.py
% Python ez_setup.py
Downloading http://cheeseshop.python.org/packages/2.4/s/
Setuptools/setuptools-0.6b1-py2.4.egg # md5 = b79a8a403e%2fbb85ee3f19%35cb
Processing setuptools-0.6b1-py2.4.egg
Creating/sw/lib/python2.4/site-packages/setuptools-0.6b1-py2.4.egg
Extracting setuptools-0.6b1-py2.4.egg to/sw/lib/python2.4/site-packages
Removing setuptools 0.6a11 from a easy-install.pth file
Adding setuptools 0.6b1 to THE easy-install.pth file
Installing easy_install script to/sw/bin
Installing easy_install-2.4 script to/sw/bin.
Installed/sw/lib/python2.4/site-packages/setuptools-0.6b1-py2.4.egg
Processing dependencies for setuptools
To access the Internet as needed, you need to set the network environment IP address + DNS.
3 EnvironmentError: mysql_config not found
MySQL-python-1.2.2] # vi setup_posix.py
26 mysql_config.path = "/usr/local/mysql/bin/mysql_config"
Change 26 rows to the actual path of mysql_config
Run python setup. py build again; python setup. py install again
OK.
4/usr/bin/ld: cannot find-lmysqlclient_r
Solution 1 (tested)
Run the following command:
Echo "/usr/local/mysql/lib/mysql">/etc/ld. so. conf (my environment is CentOS 5)
Ldconfig. The above error is still prompted after execution.
--------
Later it seems that README, the original text is below
-------
Threadsafe
Thread-safe client library (libmysqlclient_r) if True (default );
Otherwise use non-thread-safe (libmysqlclient). You shocould
Always use the thread-safe library if you have the option;
Otherwise you * may * have problems.
-----------
We know that we have to modify site. cfg and set thread-safe to false. Everything is OK!
Python setup. py install
Solution 2 (not tested) A thread-safe client library (libmysqlclient_r) will be created automatically during the compilation of MySQL if the configure command contains the option "-- enable-thread-safe-client ".