Python MySQLdb "error: Microsoft Visual C++ 14.0 is required" even though it has been installed

python mysqlclient
python mysqldb github
python mysqldb cursor
mysql.connector.connect python
python db-api
python database
import mysqldb
no module named 'mysqldb'

I'm attempting to connect to a MySql database and use its data for some code, though when I'm using

pip install mysqlclient

it gives me an error stating:

"error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools"

This link provided does not work, though i found out the correct link and installed the build tools as well as the "Windows 10 SDK" as other posts have specified. I sadly still am getting this error.

Anyone know what is wrong? Thanks!


I believe if you need MySQL database, this is installed by other means i.e. see Microsoft webpage for details (https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html).

If you just want to connect to MySQL database from Python, try installing mysql-connector instead.

pip install mysql-connector

MySQL-python · PyPI, MySQLdb is an interface to the popular MySQL database server for Python. The design goals are: Compliance with Python database API version 2.0 [PEP-0249]​  We would learn all the concepts using MySQL, so let us talk about MySQLdb module. What is MySQLdb? MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2.0 and is built on top of the MySQL C API. How do I Install MySQLdb?


It's a complicated environment.

I suggest to use pyodbc to connect to your database ( it isn't required by c++ compiler installation)

Try to convert the below code in your program

import pyodbc

conn = pyodbc.connect('DRIVER={MySQL};SOCKET=/var/lib/mysql/mysql.sock;UID=rooter;PWD=sshh') 

MYSQLdb Connection in Python, MySQLdb is an interface for connecting to a MySQL database server from Python​. It implements the Python Database API v2.0 and is built on top of the MySQL C  MySQLdb is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2.0 and is built on top of the MySQL C API. Packages to Install


Try this:

1- Download mysqlclient wheel on Unoffical Windows Binaries for Python Extension Packages. (search for mysqlclient-1.3.13-cp37-cp37m-win32)

2- Install manually pip install mysqlclient-1.3.13-cp37-cp37m-win32.whl

Python MySQL, Install MySQL Driver. Python needs a MySQL driver to access the MySQL database. In this tutorial we will use the driver "MySQL Connector". We recommend  MySQLdb is an api for accessing MySQL database using python. It is built on top of MySQL C API. MySQLdb don't yet have support for python 3, it supports only python 2.4 - 2.7 .


Python - MySQL Database Access, MySQLdb is an interface for connecting to a MySQL database server from Python​. It implements the Python Database API v2.0 and is built on top of the MySQL C  MySQLdb is a thin Python wrapper around _mysql which makes it compatible with the Python DB API interface (version 2). In reality, a fair amount of the code which implements the API is in _mysql for the sake of efficiency.


MySQL :: MySQL Connector/Python Developer Guide :: 5.1 , 5.1 Connecting to MySQL Using Connector/Python. The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object. MySQLdb is an interface to the popular MySQL database server for Python. The design goals are: Compliance with Python database API version 2.0 ; Thread-safety; Thread-friendliness (threads will not block each other) MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release.


MySQL :: MySQL Connector/Python Developer Guide :: 7.1 , 7.1 Connector/Python Connection Arguments. A connection with the MySQL server can be established using either the mysql.connector.connect() function or the  Please note MySQLdb only supports Python 2. For Windows user, you can get an exe of MySQLdb. For Linux, this is a casual package (python-mysqldb). (You can use sudo apt-get install python-mysqldb (for debian based distros), yum install MySQL-python (for rpm-based), or dnf install python-mysql (for modern fedora distro) in command line to download.)