[Python] problems connecting to port 3306 mysql workbench with my python file [duplicate]

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to make my project which uses sql connector to connect with mysql, so i only require my mysql gui user name and password but it isn't working saying can't connect with port 3306 . mysql cli is also not opening. I also can't connect to the MySQL server using the MySQL workbench:

    Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)

    this error was showed in my python run file:

    Error connecting to MySQL database: 2003: Can't connect to MySQL server on 'localhost:3306' (Errno 10061: No connection could be made because the target machine actively refused it)

    Traceback (most recent call last): File "C:\Users\shash\AppData\Roaming\Python\Python313\site-packages\mysql\connector\network.py", line 795, in open_connection self.sock.connect(sockaddr) ~~~~~~~~~~~~~~~~~^^^^^^^^^^ ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

    File "C:\Users\shash\AppData\Roaming\Python\Python313\site-packages\mysql\connector\network.py", line 806, in open_connection raise InterfaceError( ...<2 lines>... ) from err mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (Errno 10061: No connection could be made because the target machine actively refused it)

    Thinking it's mysql problem, I checked if mysql is working or not directly in Terminal with the command telnet 3306: C:\Windows\System32>sc query mysql [SC] EnumQueryServicesStatus:OpenService FAILED 1060: The specified service does not exist as an installed service.

    i don't know what to do now, can anyone help me ?

    I'm using:

    OS Windows 11 MySQL workbench 8.0

    help to solve this problem as i have to connect mysql with my python file.

    Continue reading...

Compartilhe esta Página