Spaces:
Sleeping
Sleeping
File size: 804 Bytes
bd98c1d 1e4386d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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}")
|