20 lines
482 B
Python
20 lines
482 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
|
|
|