MySQL Connector/Python Developer Guide  /  Connector/Python Installation

Chapter 4 Connector/Python Installation

Connector/Python runs on any platform where Python is installed. Python comes preinstalled on most Unix and Unix-like systems, such as Linux, macOS, and FreeBSD. On Microsoft Windows, a Python installer is available at the Python Download website. If necessary, download and install Python for Windows before attempting to install Connector/Python.


Connector/Python requires python to be in the system's PATH and installation fails if python cannot be located. On Unix and Unix-like systems, python is normally located in a directory included in the default PATH setting. On Windows, if you install Python, either enable Add python.exe to Path during the installation process, or manually add the directory containing python.exe yourself.

For more information about installation and configuration of Python on Windows, see Using Python on Windows in the Python documentation.

Connector/Python implements the MySQL client/server protocol two ways:

  • As pure Python. This implementation of the protocol does not require any other MySQL client libraries or other components.

  • As a C Extension that interfaces with the MySQL C client library. This implementation of the protocol is dependent on the client library, but can use the library provided by either MySQL Connector/C or MySQL Server packages (see MySQL C API Implementations). The C Extension is available as of Connector/Python 2.1.1.

Neither implementation of the client/server protocol has any third-party dependencies. However, if you need SSL support, verify that your Python installation has been compiled using the OpenSSL libraries.

Installation of Connector/Python is similar on every platform and follows the standard Python Distribution Utilities or Distutils. Distributions are available in native format for some platforms, such as RPM packages for Linux.

Python terminology regarding distributions:

  • Built Distribution: A package created in the native packaging format intended for a given platform. It contains both sources and platform-independent bytecode. Connector/Python binary distributions are built distributions.

  • Source Distribution: A distribution that contains only source files and is generally platform independent.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by Bob Stein on April 4, 2017
On CentOS (RHEL), the procedures here got me no joy. Installing the python and python-cext RPMs seemed to work (except for a warning ... NOKEY) but I could not import. What worked for me:

$ pip install mysql-connector-python-rf

Thanks to "Rishi" at
Sign Up Login You must be logged in to post a comment.