Despite being decades old, MySQL is still one of the most popular database management platforms developers use worldwide. However, as easy as it is to use and set up, it can sometimes run into bugs and glitches that might leave you scratching your head.
In this article, we’re talking about the “OSerror: MySQL_Config not found” issue, its causes and what you can do to fix the problem.
What causes the “OSerror: MySQL_Config not found” issue?
The error can be triggered by a couple of things, such as:
- Corresponding language drivers aren’t installed
- MySQL isn’t installed on the target system
Also read:How to fix SQL error 42501?
How to fix the “OSerror: MySQL_Config not found” issue?
The first thing you should do is check to see if MySQL is installed properly or not. Before you can run interfaces for MySQL, a base installation of MySQL itself is a prerequisite. Based on your Linux distro, the command below should be able to fix the problem.
sudo apt-get install mysql-serversudo apt-get install libmysqlclient-devsudo apt-get install libmariadbclient-dev
Once installed, try installing and running whatever interface you previously used, and the error should be gone. Since the error will likely surface on Python-related interfaces, you should install the Python MySQL interface using this command.
pip install mysqlclient
Once the interface is installed, you can install whatever problematic package you were working with to see if the problem has been fixed.
Alternatively, if the aforementioned commands don’t fix the problem, try installing pymsql, mysqlconnector-python or MySQL-python to see if either of these interfaces can fix your problem using these commands.
pip install pymysql
pip install mysql-connector-python
pip install MySQL-python