Python MySQL Connector is a driver officially provided by MySQL. It is used to establish connection between Python and MySQL. It enables Python programs to access MySQL databases. It is designed and developed based on the API that is compliant with the Python Database API Specification. It does not have any dependencies but you must have Python installed.
This connector is written purly using Python language. It provides support for MySQL, SQL and their extentions. It has many features which are listed below.
It has no third party API/module dependency.
It supports not only MySQL but also all MySQL extensions to standard SQL syntax.
The Python MySQL connector version 8.0 also supports X DevAPI.
It helps to convert parameter values back and forth between Python and MySQL data types.
It enables compressing the data stream between the client and server.
It helps to establish connections using TCP/IP sockets and Unix sockets.
It supports for MySQL Server up to and including MySQL Server version 5.7.
It secures TCP/IP connections using SSL.
While working with Python and MySQL, make sure you have correct version of both. We have list out versions of MySQL and Python connector to match compatibility. See the below table.
Connector/Python Version |
MySQL Server Versions |
Python Versions |
---|---|---|
8.0 |
8.0, 5.7, 5.6, 5.5 |
3.8, 3.7, 3.6, 3.5, 3.4, 2.7 |
2.2 (continues as 8.0) |
5.7, 5.6, 5.5 |
3.5, 3.4, 2.7 |
2.1 |
5.7, 5.6, 5.5 |
3.5, 3.4, 2.7, 2.6 |
2.0 |
5.7, 5.6, 5.5 |
3.5, 3.4, 2.7, 2.6 |
1.2 |
5.7, 5.6, 5.5 (5.1, 5.0, 4.1) |
3.4, 3.3, 3.2, 3.1, 2.7, 2.6 |
Note: This Python driver does not support the old MySQL Server authentication methods, which means that MySQL versions prior to 4.1 will not work.
In this tutorial, we learnt about the Python MySQL connector/driver its features and versions compatable to MySQL database. how to connect to MySql database.
In the next tutorial, we will learn to install Python MySQL connector/driver and after that we will start working with MySQL database. Till then keep learning!