How to install MySQL Connector Package in Python
Last Updated : 25 Mar, 2025
MySQL is a Relational Database Management System (RDBMS) whereas the structured
Query Language (SQL) is the language used for handling the RDBMS using commands i.e
Creating, Inserting, Updating and Deleting the data from the databases. A connector is
employed when we have to use MySQL with other programming languages. The work of
mysql-connector is to provide access to MySQL Driver to the required language. Thus, it
generates a connection between the programming language and the MySQL Server.
Installation Instructions
To install Python-mysql-connector module, one must have Python and PIP, preinstalled on
their system. To check if our system already contains Python, go through the following
instructions:
Step 1: Check if Python is Installed
Open the Command line(search for cmd in the Run dialog(Windows + R). Now run the
following command:
python --version
If Python is already installed, it will generate a message with the Python version available.
If Python is not present, go through How to install Python on Windows and Linux? and
follow the instructions provided.
Step 2: Check if PIP is Installed
PIP is a package management system used to install and manage software
packages/libraries written in Python. These files are stored in a large “on-line repository”
termed as Python Package Index (PyPI). To check if PIP is already installed on our system,
just go to the command line and execute the following command:
pip --version
If PIP is not present, go through How to install PIP on Windows and
Linux?
Step 3: Install MySQL Connector for Python
Once Python and PIP are installed, we can proceed with installing the MySQL
Connector package for Python.
For Windows
mysql-connector method can be installed on Windows with the use of following
command:
pip install mysql-connector-python
For Linux
mysql-connector method can be installed on Linux with the use of following
command:
pip3 install mysql-connector
Comment
More info
Campus Training Program
Next Article
Connect MySQL database using MySQL-Connector Python
Similar Reads
How to Check If Python Package Is Installed
In this article, we are going to see how to check if Python package is installed or not. Check
If Python Package is InstalledThere are various methods to check if Python i...
15+ min read
How to Install python 'bottle package' on Linux?
py-bottle is a lightweight micro-framework for developing small web apps and it supports
request dispatching (Routes) with URL parameter support, templates, a built-in HTT...
10 min read
How To List Installed Python Packages
Working on Python projects may require you to list the installed Python packages in order
to manage dependencies, check for updates, or share project requirements with oth...
15+ min read
How to install pyscopg2 package in Python?
psycopg2 is the most popular PostgreSQL database adapter for the Python programming
language. It is a DB API 2.0 compliant PostgreSQL driver is actively developed. It is d...
6 min read
How to Install psycopg2 Binary Module in Python ?
psycopg2 is the most popular PostgreSQL database adapter for the Python programming
language. It is a DB API 2.0 compliant PostgreSQL driver that is actively developed. It...
6 min read
How to Install Pytho-BioPython package on Linux?
Biopython is a collection of publicly accessible Python libraries for biological computing
built by a multinational team of developers in Python 3. BioPython is a collabor...
8 min read
How to Install Pandas in Python?
Pandas in Python is a package that is written for data analysis and manipulation. Pandas
offer various operations and data structures to perform numerical data manipulatio...
15+ min read
How to Install mechanize for Python?
In this article, we are going to install mechanize for Python. Mechanize was designed by
John J. Lee. and Maintenance take over by Kovid Goyal in 2017. It follows the Stat...
10 min read
MySQL-Connector-Python module in Python
MySQL is a Relational Database Management System (RDBMS) whereas the structured
Query Language (SQL) is the language used for handling the RDBMS using commands i.e
Creatin...
13 min read
How to Install python packages Locally with easy_install?
easy_install was included in setuptools in 2004 and is now deprecated. It was remarkable
at the time to automatically install dependencies and install packages from PyPI u...
5 min read