Mysql – thesql-python with MySQL 5.6

MySQLpippython

I am having problems installing the mysql-python module in my server (CentOS 6.4 x86_64) with MySQL 5.6 installed and Python 2.6.6.

[python@localhost ~]$ rpm -qa | grep SQL
MySQL-shared-compat-5.6.12-2.el6.x86_64
MySQL-server-5.6.12-2.el6.x86_64
MySQL-devel-5.6.12-2.el6.x86_64
MySQL-client-5.6.12-2.el6.x86_64

And when I try to install the last version of mysql-python through pip:

[python@localhost ~]$ pip install MySQL-python==1.2.4

I get a enormous compilation error which ends in:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 33: ordinal not in range(128)

Has someone has installed the mysql-python module in this conditions?

I'm attaching the log file in case it can help.

Best Answer

Use yum to install required package:

yum install MySQL-python

Also, looks like you've installed mysql from mysql.com, it may break dependencies, because here is how original packages look like:

[root@main ~]# yum install mysql-server
Loaded plugins: downloadonly, security, versionlock
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.69-1.el6_4 will be installed
--> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-server-5.1.69-1.el6_4.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.69-1.el6_4.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.69-1.el6_4 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                       Arch                  Version                         Repository              Size
==================================================================================================================
Installing:
 mysql-server                  x86_64                5.1.69-1.el6_4                  updates                8.7 M
Installing for dependencies:
 mysql                         x86_64                5.1.69-1.el6_4                  updates                907 k
 perl-DBD-MySQL                x86_64                4.013-3.el6                     base                   134 k

Transaction Summary
==================================================================================================================
Install       3 Package(s)

Total download size: 9.7 M
Installed size: 27 M
Is this ok [y/N]: