Mysql connecttion error

Boss see my code
please check the mysql connection is ok or not

import mysql.connector
import streamlit as st
import pandas as pd

mydb = mysql.connector.connect(
host=“mysql-123f4ea8-schoolpro.f.aivencloud.com”,
user=“avnadmin”,
password=“**********”,
database=“defaultdb”,
port=11726)

st.write(mydb)
curr = mydb.cursor()
st.write(curr)

Hi,

can you check with this code:

Import mysql.connector
import streamlit as st
import pandas as pd

mydb = mysql.connector.connect(
host=“mysql-123f4ea8-schoolpro.f.aivencloud.com”,
user=“avnadmin”,
password=“your_password_here”, # Replace with actual password
database=“defaultdb”,
port=11726
)

if mydb.is_connected():
st.write(“Connected to the database successfully!”)
curr = mydb.cursor()
st.write(“Cursor initialized:”, curr)
else:
st.write(“Failed to connect to the database.”)