Software⏱️ 2 min read📅 2026-05-30

How to Fix: pip install mysql-python fails with EnvironmentError: mysql_config not found

pip install mysql-python fails due to missing mysql_config, a required tool for MySQL development.

Quick Answer: Install the mysql-connector-python library instead of mysql-python, which does not require mysql_config.

To resolve the 'mysql_config not found' error when installing mysql-python using pip, you need to ensure that the MySQL development package is installed on your system.

🛠️ Step-by-Step Verified Fixes

Method 1: Install MySQL Development Package

  1. Step 1: Open a terminal or command prompt and run the following command to install the MySQL development package on Ubuntu/Debian-based systems: sudo apt-get install libmysql-dev

Method 2: Install MySQL Development Package on Red Hat/CentOS/Fedora-based Systems

  1. Step 1: Open a terminal or command prompt and run the following command to install the MySQL development package: sudo yum install mysql-devel

✨ Wrapping Up

After installing the MySQL development package, try running pip install mysql-python again to resolve the 'mysql_config not found' error.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions