tts_labeling / db_test.py
Navid Arabi
test mysql
ac40033
raw
history blame
735 Bytes
import mysql.connector
from mysql.connector import Error
config = {
"host": "annotation-db.apps.teh2.abrhapaas.com",
"user": "navid",
"password": "ZUJSK!1V!PF4ZEnIaylX",
"charset": "utf8mb4",
"port": 32107,
"use_unicode": True
}
try:
conn = mysql.connector.connect(**config)
if conn.is_connected():
print("✅OK!")
cursor = conn.cursor()
cursor.execute("SELECT VERSION()")
version = cursor.fetchone()
print("🟢MySQL Server Version:", version[0])
except Error as e:
print("❌ error:", e)
finally:
if 'cursor' in locals():
cursor.close()
if 'conn' in locals() and conn.is_connected():
conn.close()
print("⛔️Closed.")