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.

Note

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; an implementation written in Python. Its dependencies are the Python Standard Library and Python Protobuf >= 4.21.1,<= 4.21.12.

    Note

    EL7 and Ubuntu 16.04 do not provide Python Protobuf 3+ making the pure Python version unavailable on those platforms; use the C Extension variant there instead. You may have to --force the installation but may not use use_pure=True.

  • 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 MySQL Server packages (see MySQL C API Implementations).

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.

TLS Support

By default, EL8 and Debian 10 supports TLSv1.2 and later when the policy level is set to DEFAULT. To support TLSv1 and TLSv1.1, the policy needs to be changed to LEGACY. This means that a default EL8/DEB10 setup cannot make connections with TLSv1 and TLSv1.1 using the C-extension. Other platforms may change their default behavior in the future.

The TLSv1.0 and TLSv1.1 connection protocols are deprecated as of Connector/Python 8.0.26 and support for them was removed in Connector/Python 8.0.28.

Note

Support for distutils was removed in Connector/Python 8.0.32.

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.