# Connector importieren import sys, MySQLdb # Verbindung zur Datenbank auf dem Datenbankserver erstellen connection = MySQLdb.connect(host = "localhost", \ user = "psem", passwd = "psem", db = "psem") # Execution-Objekt erzeugen cursor = connection.cursor() # Datensatz erzeugen # Datensatz erzeugen sql = "INSERT INTO private_daten VALUES(NULL," \ "'Anna', 'anna.2007!', 3 , 50 , 20 , 1 )" cursor.execute(sql) connection.commit() cursor.execute("SELECT * FROM private_daten") rows=cursor.fetchall() for row in rows: print(row) # Execution-Objekt schliessen cursor.close() # Verbindung schliessen connection.close()