Hi@akhtar,
You need to use MySQL connector in your python code. I have attached one example below for your reference.
import mysql.connector
mydb = mysql.connector.connect(
  host="localhost",
  user="myusername",
  password="mypassword"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE mydatabase")