Compare commits

...

2 Commits

Author SHA1 Message Date
4196766a2b
Client credentials and change root password 2024-01-26 15:28:53 -05:00
7922fc060a
Set XDB server charset to utf8 2024-01-26 13:46:43 -05:00
2 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,7 @@ version: '3.1'
services: services:
db: db:
image: mysql:5.5.42 image: mysql:5.5.42
command: --character-set-server utf8
restart: always restart: always
ports: ports:
- 3306:3306 - 3306:3306

View File

@ -179,6 +179,7 @@ def main(conn, xdt_path):
for table_name in root: for table_name in root:
if "Table" in table_name: if "Table" in table_name:
process_xdt_table(cursor, root, table_name, mappings) process_xdt_table(cursor, root, table_name, mappings)
finalize(cursor)
conn.commit() conn.commit()
def connect_to_db(): def connect_to_db():
@ -192,10 +193,18 @@ def connect_to_db():
def prep_db(): def prep_db():
conn = connect_to_db() conn = connect_to_db()
cursor = conn.cursor() cursor = conn.cursor()
# we have to upload a lot of data, so we need to raise the limit
cursor.execute("SET GLOBAL max_allowed_packet=1073741824") cursor.execute("SET GLOBAL max_allowed_packet=1073741824")
conn.commit() conn.commit()
conn.close() conn.close()
def finalize(cursor):
# credentials used by the game
cursor.execute("GRANT SELECT ON XDB.* TO 'cmog' IDENTIFIED BY 'scooby'")
# change the root password to something more secure
new_root_pw = input("Enter new root password: ")
cursor.execute(f"SET PASSWORD = PASSWORD('{new_root_pw}')")
# %% # %%
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) != 2: if len(sys.argv) != 2: