Install MySQL Connector Python on Windows
In this article, we will walk through how to Install MySQL Connector Python on Windows. To connect to a MySQL server from Python, you need a database driver (module). MySQL Connector Python is the official Oracle-supported driver to connect MySQL through Python.
Prerequisites before installing MySQL Connector Python
• You need root or administrator privileges to perform the installation process.
• Python must be installed on your machine.
Note: – MySQL Connector Python requires python to be in the system’s PATH. Installation fails if it doesn’t find Python.
Different ways to install MySQL Connector Python
There are multiple ways to install Oracle’s MySQL Connector Python on your machine. The following are a few ways.
• Install MySQL Connector Python using the pip command
• Install MySQL connector python via source code (via ZIP or TAR file)
• Use Built Distribution A package created in the native packaging format intended for a given platform. Example, RPM packages for Linux or MSI installer for windows.
Pip Command to install MySQL Connector python
It is always accessible and straightforward to install any module using pip in python. MySQL Connector Python is available on pypi.org so you can install using pip command.
Using pip command, you can install MySQL Connector python on any operating system platform including Windows, macOS, Linux, and Unix and Ubuntu.
Use the following pip command to install MySQL Connector python.
pip install mysql-connector-python
If you are facing any problem while installing, please mention the version of the module and then try to install it again. Refer to the above table to install the correct version.
pip install mysql-connector-python==8.0.11
Download and Install MySQL Connector Python on Windows
There are two ways to install MySQL Connector Python on windows.
1. Install using Source Code Distribution ( Platform Independent and Architecture Independent ZIP Archive)
2. Install using Built Distribution i.e., MSI installer