# pip install mysql_connector <-- For Window OS (Comand Prompt/Power Shell)
# conda install mysql_connector <-- For Anaconda Shell
# pip3 install mysql_connector <-- For Mac OS Terminal
import mysql.connector as mc
db = mc.connect(host = "localhost", user = "root", password = "root")
my_cursor = db.cursor()
running = True
while running:
try:
my_query = str(input("QUERY: "))
if my_query == "QUIT":
running = False
db.close()
elif my_query == "SAVE":
db.commit()
else:
my_cursor.execute(my_query)
for i in my_cursor:
print(i)
except mc.Error as error:
print(error)