Installing MySQL connector
The connection between MySQL and Python can be established using a lot of Python Modules. MySQL connector is one such module that makes the connection between MySQL server and Python hassle-free.
How to Install MySQL connector
All python modules are installed using its own built-in command pip. issue the following pip command either on the command prompt of at the shell
$ pip install mysql-connector-python Collecting mysql-connector-python Downloading mysql_connector_python-8.0.22-cp37-cp37m-win_amd64.whl (842 kB) |████████████████████████████████| 842 kB 1.1 MB/s Requirement already satisfied: protobuf>=3.0.0 in c:\python37\lib\site-packages (from mysql-connector-python) (3.6.1) Requirement already satisfied: setuptools in c:\python37\lib\site-packages (from protobuf>=3.0.0->mysql-connector-python) (47.1.0) Requirement already satisfied: six>=1.9 in c:\users\rakesh\appdata\roaming\python\python37\site-packages (from protobuf>=3.0.0->mysql-connector-python) (1.13.0) Installing collected packages: mysql-connector-python Successfully installed mysql-connector-python-8.0.22 WARNING: You are using pip version 20.2; however, version 20.2.4 is available. You should consider upgrading via the 'c:\python37\python.exe -m pip install --upgrade pip' command.
Prerequisite. The Microsoft Visual C++ 2015 Redistributable must be installed on your system. in Windows version.
if you need to install this Python Module on different type of Linux system or Mac then please refer to its official documentation
Now it’s time to check whether it is able to install MySQL connector properly. Execute any Python Script give in this section to access database.