Problems with Mysql-python installation

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.