Facebook Pixel[Solved] No Module Named MySQLdb in Windows 10 | Blog | CodeWithHarry
[Solved] No Module Named MySQLdb in Windows 10

[Solved] No Module Named MySQLdb in Windows 10

"I was working on a personal MySQL project and encountered this issue which says: "No module named MySQLdb"..."

By CodeWithHarry

Updated: 5 April 2025

I was working on a personal MySQL project and encountered this issue, which says:

"No module named MySQLdb"

So I went to the terminal and typed pip install mysqlclient

I was welcomed with this screen:

Error Screen

The error says that Windows failed to build the MySQL extension from scratch.

How to solve this error?

All you need to do is go to the unofficial binaries for Windows 10 page and download the mysqlclient from there.

Step 1: Go to Google and type "Unofficial Python Binaries."

Step 1 Image

Step 2: Click the first link and search for mysqlclient

Step 2 Image

Step 3: Click on mysqlclient and download the wheel file for your OS.

Step 3 Image

I am using the 32-bit version of Python and Python 3.8, so I will download the cp-38-win32 wheel.

Step 4: Download the wheel and go to the folder where this wheel file is downloaded.

Step 4 Image

Step 5: cd into the directory where this wheel file is downloaded and run the pip install mysqlclient-1.4.6-cp38-cp38-win32.whl command.

The wheel file I downloaded was named mysqlclient-1.4.6-cp38-cp38-win32.whl, so I ran:

pip install mysqlclient-1.4.6-cp38-cp38-win32.whl

This will install mysqlclient on Windows, and your error will be solved! Let me know if this helped you in fixing this issue on your Windows machine.

Final Image

Note: If you are a beginner and don't know what cd into a directory means, you can go to the folder where you downloaded this wheel file and press shift, and right-click on some empty area to get an option called "Open command prompt/Powershell window here." This command will open the command prompt in the directory where you have downloaded this wheel file. Now you can type pip install Pyaudio-file-name.whl.

Tags

nomodulenamedmysqlerror