23 lines
487 B
Python
23 lines
487 B
Python
import mysql.connector
|
|
|
|
try:
|
|
conn = mysql.connector.connect(
|
|
host="192.168.1.100",
|
|
port=3306,
|
|
user="Michel",
|
|
password="wuP^wu&6xjx61bh*kjS^",
|
|
database="TestDB"
|
|
)
|
|
|
|
cursor = conn.cursor()
|
|
cursor.execute("SELECT VERSION();")
|
|
version = cursor.fetchone()
|
|
|
|
print("Connexion OK")
|
|
print("Version MariaDB :", version[0])
|
|
|
|
cursor.close()
|
|
conn.close()
|
|
|
|
except mysql.connector.Error as err:
|
|
print("Erreur MySQL :", err) |