Pruefungskatalog/database_connection.py
2022-03-21 22:19:07 +01:00

13 lines
475 B
Python

import mysql.connector
# Aufbau der verbindung zum Mysql Server
def db_connection(user, password, host, database):
connection = ''
try:
# Verbindung - Eingaben in der config.py bestimmen
connection = mysql.connector.connect(user=user, password=password, host=host, database=database)
except mysql.connector.Error as err:
print('Something went wrong', err)
print('Veruche deinen Mysql Server neu zu starten')
return connection