14

I'm attempting to install MySQL-python on a machine running CentOS 5.5 and python 2.7. This machine isn't running a mysql server, the mysql instance this box will be using is hosted on a separate server. I do have a working mysql client. On attempting sudo pip install MySQL-python, I get an error of EnvironmentError: mysql_config not found, which as far as I can tell is a command that just references /etc/my.cnf, which also isn't present. Before I go on some wild goose chase creating spurious my.cnf files, is there an easy way to get MySQL-python installed?

3 Answers 3

21

So it transpires that mysql_config is part of mysql-devel. mysql-devel is for compiling the mysql client, not the server. Installing mysql-devel allows the installation of MySQL-python.

Sign up to request clarification or add additional context in comments.

3 Comments

in centos 7 mysql-devel aliases mariadb-devel, both can be specified to install the required dependencies.
@tutuDajuju thanks! Consider adding that as an answer, since it was useful to some people already :)
@tutuDajuju that was the only thing that worked for me. Thanks!
7

I couldn't find a question specific to CentOS 6.x, and this solution doesn't work out of the box for that platform. I'll post my discovery here in the hope that it helps the next poor soul who encounters the problem.

The CentOS Yum repository serves up a version of the MariaDB distributions that don't include mysql_config. To fix, add a file containing something like the following to /etc/yum.repos.d/MariaDB.repo:

# MariaDB 5.5 CentOS repository list - created 2016-04-21 20:25 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

This is the repo config specified (for CentOS 6 and MariaDB 5.5) by MariaDB at https://downloads.mariadb.org/mariadb/repositories/. Of course if your environment differs you should go through the configurator at that URL.

Once you've done that, you may need to call

yum remove MariaDB-devel
yum clean metadata
yum install MariaDB-devel

Then give the Pip install a try.

2 Comments

On centos 7, you need to use mariadb-devel
This is what worked for me after wasting many man working hours scouring the internet days on end. I am on CentOS 7.
4

I'm using RHEL 7 and have de same question

sudo yum install mariadb-devel

works fine to me :)

note: above comment was edited to remove the typo

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.