You can get the result of a query using Pythong mysql-connector-python library

Below code is for connecting to a MySQL database and fetching the result of a query using the Python mysql-connector-python library:

import mysql.connector

# Establish a connection to the database
cnx = mysql.connector.connect(user='user', password='password',
host='host', database='database')

# Create a cursor object to execute queries
cursor = cnx.cursor()

# Execute a query to retrieve data
query = "SELECT * FROM table_name"
cursor.execute(query)

# Fetch all the rows of the result
rows = cursor.fetchall()

# Loop through the rows and print the data
for row in rows:
print(row)

# Clean up
cursor.close()
cnx.close()