Spaces:
Sleeping
Sleeping
import pymysql | |
try: | |
print("Connecting to MariaDB...") | |
conn = pymysql.connect( | |
host="192.250.235.27", # or your DB host, e.g. "127.0.0.1" | |
port=3306, | |
user="cybersan_bridgementor", # replace with your MySQL username | |
password="bridgementor", # replace with your MySQL password | |
database="cybersan_bridgementor", # replace with your database name | |
) | |
print("Connected successfully.") | |
cursor = conn.cursor() | |
print("Fetching table list...") | |
cursor.execute("SHOW TABLES") | |
print("Tables in the database:") | |
for (table_name,) in cursor.fetchall(): | |
print(f"- {table_name}") | |
cursor.close() | |
conn.close() | |
print("Connection closed.") | |
except pymysql.MySQLError as e: | |
print(f"MariaDB connection error: {e}") | |