Install a mysqldb under Linux to allow Python to read and write MySQL, problems that arise
System environment
1.Oracle Linux 6.5
2.mysql Community 5.7.9
3.python Default 2.6.6
4.mysql_python-1.2.3
Installation
1. Installing Mysql-python
Unzip the tar zxvf mysql-python-1.2.3.tar.gz
Go to Catalog
2.python setup.py Build Compilation
At this time, it may be necessary to install SETUPTOOL,GCC, if prompted to find a similar mysqlclient
Everyone can do
Ln-s/USR/LIB64/MYSQL/LIBMYSQLCLIENT.A/USR/LIB/LIBMYSQLCLIENT.A
Ln-s/USR/LIB64/MYSQL/LIBMYSQLCLIENT_R.A/USR/LIB/LIBMYSQLCLIENT_R.A
Specific reasons I am not very clear, in fact, if you can change the default directory to/usr/lib64, the best
As for Threadsafe, you don't have to change to false.
# The path to mysql_config.# only with this if mysql_config are not on your path, or you had some weird# setup that require s it.mysql_config =/usr/bin/mysql_config
Mysql_config This directory for a change, you can use Whereis mysq_config find
Python setup.py install (still need this step, everybody don't forget)
3. If prompted
If you're suggesting this, don't be afraid, I'll fall from here.
It was found that the compiler used to compile Python was different from the compiler used to compile Mysql-python.
Recompile _mysql.so with g++
If you find that your machine is not g++ or is not available with Yum install g++
You need yum to install gcc-c++ libstdc++-devel this.
First to enter the mysql-python build directory, mine is 2.6, you have to change according to your own
g++-pthread-shared./temp. linux-x86_64-2.6/_mysql. o-l/usr/lib64-l Mysqlclient_r-lpthread-lm-lrt-ldl-o./ Lib.linux-x86_64-2.6/_mysql.so
And then you can recompile it.
Problems with Mysql-python installation