You can connect with MySql database in Python using mysql connector python. You will need to install it first using below command and import it in your program. Refer to below example how to install and execute sql queries.
pip install mysql-connector-python
from mysql.connector import Error
cn = mysql.connector.connect(host='localhost',database='mysqlweb',user='root',password='')
dbinfo = cn.get_server_info()
print("Connected to MySql database!")
cursor = cn.cursor()
record = cursor.fetchone()
print("You are connected to: ", record)
except Error as e:
print("Error while connecting to mysql:", e)
print("All connection closed!")
If you face any problem to understand above example at any point, write below your concern and will repond you soon.