In order to open a connection with MYSQL database from within Python using mysql.connector package, function is used. code example
Example: how to connect to mysql database in python
import mysql.connector
cnx = mysql.connector.connect(user='scott', password='password',
host='127.0.0.1',
database='employees')
cnx.close()