Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

share|improve this question
Your goal is to install latest version or stable one? – GioMac Aug 28 '13 at 16:48
My goal is to install the 5.6 version of MySQL because of the full-text search feature. – B166ER Aug 28 '13 at 17:55
I mean MySQL-python, not MySQL :) – GioMac Aug 28 '13 at 17:59
up vote 2 down vote accepted

Use yum to install required package:

yum install MySQL-python

Also, looks like you've installed mysql from, 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
 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]: 
share|improve this answer
I installed MySQL version 5.6 because of the InnoDB full-text search feature.Installing the 5.1 version is not an options, but thank you for the quick response! :) – B166ER Aug 28 '13 at 17:55
yum install MySQL-python will work anyway - latest available stable version is MySQL-python-1.2.3-0.3.c1.1.el6. – GioMac Aug 28 '13 at 17:57
Thank you very much Mr. @GioMac :) – B166ER Aug 28 '13 at 20:06
you're welcome sir – GioMac Aug 28 '13 at 20:07

You can fix this UnicodeDecodeError by forcing pip use the default the default localization settings

LC_ALL=C pip install MySQL-python
share|improve this answer
This is a better answer if you're using virtualenv or tox and don't want the MySQL-python installed globally on your system. – aezell Jul 18 '14 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.