-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset_database.py
More file actions
29 lines (24 loc) · 1009 Bytes
/
reset_database.py
File metadata and controls
29 lines (24 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
import sys
import mysql.connector
database = "Test_db"
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: <root_user_name> <root_user_password>")
else:
try:
user_name = sys.argv[1]
user_pw = sys.argv[2]
db = mysql.connector.connect(host="85.235.144.146", user=user_name, password=user_pw, database=database)
db.cursor().execute("DROP TABLE users")
db.cursor().execute("DROP TABLE logs")
db.cursor().execute("DROP TABLE logs_attention")
db.cursor().execute("DROP TABLE logs_dice")
db.cursor().execute("DROP TABLE questionnaire_logs")
db.cursor().execute("DROP TABLE demographics")
db.cursor().execute("DROP TABLE elapsedtime_logs")
db.cursor().execute("DROP TABLE users_payout")
db.cursor().execute("DROP TABLE logs_help")
db.commit()
except Exception as ex:
print(ex)