import mysql.connector from time import sleep import random import sys ## C:\ProgramData\MySQL\MySQL Server 8.0\my.ini ## https://dev.mysql.com/doc/refman/8.0/en/caching-sha2-pluggable-authentication.html#caching-sha2-pluggable-authentication-installation try: username = "yourusername"; password="yourpassword"; database="yourdatabase";host="localhost"; cnx = mysql.connector.connect(user=username, password=password, host=host,database=database) cursor = cnx.cursor() print("Successfully connected to database!") update = True while update: try: value = random.randint(0,1024) sensor_value = value ...