Estou com esse problema, copiei o script e quando vou rodar surge o seguinte erro:
C:\Users\Microsoft\PycharmProjects\jogoteca\venv\Scripts\python.exe C:/Users/Microsoft/PycharmProjects/jogoteca/prepara_banco.py
Conectando...
Traceback (most recent call last):
File "C:\Users\Microsoft\PycharmProjects\jogoteca\prepara_banco.py", line 17, in <module>
cursor = conn.cursor()
NameError: name 'conn' is not defined
2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (10061)
Process finished with exit code 1