MySQL Connector/Python Developer Guide
Connector/Python installers in native package formats are available for Windows and for Unix and Unix-like systems:
Windows: MSI installer package
Linux: Yum repository for EL7 and EL8 and Fedora; RPM packages for Oracle Linux, Red Hat, and SuSE; Debian packages for Debian and Ubuntu
macOS: Disk image package with PKG installer
You may need root
or administrator privileges
to perform the installation operation.
Prior to Connector/Python 8.0.22, the C extension and pure Python implementations were installed using two separate binary distributions; except they were always combined for Windows and macOS. The C extension implementation had “cext” in the package name.
Binary distributions that provide the C Extension link to an already installed C client library provided by a MySQL Server installation. For those distributions that are not statically linked, you must install MySQL Server if it is not already present on your system. To obtain it, visit the MySQL download site.
Use pip to install Connector/Python on most any operating system:
shell> pip install mysql-connector-python
Managing all of your MySQL products, including MySQL Connector/Python, with MySQL Installer is the recommended approach. It handles all requirements and prerequisites, configurations, and upgrades.
Prerequisite. The Microsoft Visual C++ 2015 Redistributable must be installed on your system.
MySQL Installer (recommended): When executing MySQL Installer, choose MySQL Connector/Python as one of the products to install. MySQL Installer installs the Windows MSI Installer described in this documentation.
Windows MSI Installer (.msi
file): To use
the MSI Installer, launch it and follow the prompts in the
screens it presents to install Connector/Python in the location of your
choosing.
Like with MySQL Installer, subsequent executions of the Connector/Python MSI enable you to either repair or remove the existing Connector/Python installation.
Connector/Python Windows MSI Installers (.msi
files)
are available from the Connector/Python download site (see
Section 4.1, “Obtaining Connector/Python”). Choose an
installer appropriate for the version of Python installed on
your system. As of Connector/Python 2.1.1, MSI Installers include the C
Extension; it need not be installed separately.
Alternatively, to run the installer from the command line, use
this command in a console window, where
VER
and
PYVER
are the respective
Connector/Python and Python version numbers in the installer file
name:
shell> msiexec /i mysql-connector-python-VER
-pyPYVER
.msi
Subsequent executions of Connector/Python using the MSI installer permit you to either repair or remove the existing Connector/Python installation.
For EL7 or EL8-based platforms and Fedora, you can install Connector/Python using the MySQL Yum repository (see Installing Additional MySQL Products and Components with Yum). You must have the MySQL Yum repository on your system's repository list (for details, see Adding the MySQL Yum Repository). To make sure that your Yum repository is up-to-date, use this command:
shell> sudo yum update mysql-community-release
Then install Connector/Python as follows:
shell> sudo yum install mysql-connector-python
Connector/Python Linux RPM packages (.rpm
files) are
available from the Connector/Python download site (see
Section 4.1, “Obtaining Connector/Python”).
To install a Connector/Python RPM package (denoted here as
), use
this command:
PACKAGE
.rpm
shell> rpm -i PACKAGE
.rpm
Prior to Connector/Python 8.0.22, the C extension implementation was a separate RPM package that contained “cext” in the name.
RPM provides a feature to verify the integrity and authenticity of packages before installing them. To learn more, see Verifying Package Integrity Using MD5 Checksums or GnuPG.
Connector/Python Debian packages (.deb
files) are
available for Debian or Debian-like Linux systems from the Connector/Python
download site (see Section 4.1, “Obtaining Connector/Python”).
To install a Connector/Python Debian package (denoted here as
), use
this command:
PACKAGE
.deb
shell> dpkg -i PACKAGE
.deb
Prior to Connector/Python 8.0.22, the C extension implementation was a separate DEB package that contained “cext” in the name.
Connector/Python macOS disk images (.dmg
files) are
available from the Connector/Python download site (see
Section 4.1, “Obtaining Connector/Python”). As of Connector/Python 2.1.1,
macOS disk images include the C Extension; it need not be
installed separately.
Download the .dmg
file and install Connector/Python by
opening it and double clicking the resulting
.pkg
file.