各种纠结,各种问题。记录一下。
基本流程:
$ tar xfz MySQL-python-1.2.1.tar.gz
$ cd MySQL-python-1.2.1
$ # edit site.cfg if necessary
$ python setup.py build
$ sudo python setup.py install # or su first
注意点:
(1)配置site.cfg文件。
mysql_config问题修改:
打开site.cfg中的注释,指向自己的mysql_config mysql_config = /home/work/local/mysql/bin/mysql_config
threadsafe 改为 False
(2)vi ~/.bash_profile
在~/.bash_profile中添加:
#exportLD_LIBRARY_PATH=/home/mysql/mysql/lib/mysql/:$ LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/home/work/local/mysql/lib/mysql/:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=:/home/ work/local/mysql/lib/mysql
然后:
$source ~/.bash_profile
$ python
Python 2.5.4 (r254:67916, Feb 1 2010, 19:57:04)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright","credits" or "license" for more information.
>>> import MySQLdb