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?
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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With