Download: wget http://sourceforge.net/projects/mysql-python/files/latest/downloa
Cd/root/MySQL-python-1.2.4b4
Tar-zxvf MySQL-python-1.2.4b4.tar.gz
# Vi site. cfg
Embedded = False
Threadsafe = True
Static = False
Mysql_config =/usr/local/mysql/bin/mysql_config
# Python setup. py build
# Python setup. py install
# Python
>>> Import MySQLdb
Traceback (most recent call last ):
File "<stdin>", line 1, in <module>
File "MySQLdb/_ init _. py", line 19, in <module>
Import _ mysql
ImportError: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory
>>>
The reason is that python cannot find the libmysqlclient_r.so.16 dynamic library in the mysql directory. In fact, MySQLdb calls the c function library of mysql. mysql must be installed first on the local machine.
# Ln-s/usr/local/mysql/lib/mysql/libmysqlclient_r.so.16/usr/lib