[Python] I can't see if my python-mysql connection is active

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using python and I'm trying to make a connection to a MySQL db. The problem is that when I run this code:

    import mysql.connector
    print('Attempting connection to database...')

    con = mysql.connector.connect(
    host="localhost",
    user="root",
    password="root"
    )

    print(con)


    The terminal doesn't shows me the print. I've been debugging and I noticed that the program executes till the line 7 then jumps directly to the line 4 and finish the execution. I don't know if this behavior is normal but I'd like to know how to solve this, please :D

    I'm also using MySQL Workbench to see if the connection is ok and it actually works.

    Continue reading...

Compartilhe esta Página