Databases!

What is PyMySQL?

PyMySQL is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2.0 and contains a pure-Python MySQL client library. The goal of PyMySQL is to be a drop-in replacement for MySQL db.

How do I Install PyMySQL?

Before proceeding further, you make sure you have PyMySQL installed on your machine. Just type the following in your Python script and execute it.

import pymysql #else we can use, import mysql.connector

If it produces the following result, then it means MySQL db module is not installed .

Traceback (most recent call last):

File "test.py", line 3, in <module>

Import pymysql

ImportError: No module named pymysql

The last stable release is available on PyPI and can be installed with pip.

pip install pymysql #else we can use, pip install mysql-connector-python

Database Connection