import pymysql class My_sql(): def __init__(self, host, user, passwd, db, port=3306, charset='utf8'): try: self.my_db = pymysql.connect(host=host, user=user, passwd=passwd, db=db, port=port, charset=charset, autocommit=True) except Exception as e: pr…