sqlmapproject/sqlmap · error · OperationalError

could not connect to '%s:%s' (%s)

Error message

could not connect to '%s:%s' (%s)

What it means

Error "could not connect to '%s:%s' (%s)" thrown in sqlmapproject/sqlmap.

Source

Thrown at extra/dbwire/mysql.py:289

            _send_packet(sock, seq + 1, data)
        elif marker == 0x01:  # AuthMoreData (caching_sha2)
            status = _u8(payload, 1)
            if status == 0x03:  # fast auth success -> OK packet follows
                continue
            elif status == 0x04:  # full auth required (needs TLS or RSA - not available stdlib-only)
                raise NotSupportedError("caching_sha2_password full authentication over a plaintext connection "
                                        "requires RSA/TLS; use a mysql_native_password account for the dependency-free client")
            else:
                raise OperationalError("unexpected caching_sha2 auth status %d" % status)
        else:
            raise InterfaceError("unexpected authentication response 0x%02x" % marker)

def connect(host=None, port=3306, user=None, password=None, database=None, connect_timeout=None, **kwargs):
    try:
        sock = socket.create_connection((host or "localhost", int(port or 3306)), timeout=connect_timeout)
        keepalive(sock)
    except (socket.error, socket.timeout) as ex:
        raise OperationalError("could not connect to '%s:%s' (%s)" % (host, port, ex))

    try:
        seq, payload = _read_packet(sock)
        if _u8(payload, 0) == 0xff:
            raise OperationalError("(remote) %s" % _err_message(payload))

        off = 1                                         # protocol version (10)
        _, off = _cstring(payload, off)                 # server version
        off += 4                                        # connection id
        salt = payload[off:off + 8]; off += 8 + 1       # auth-plugin-data part 1 (+ filler)
        server_caps = _u16(payload, off); off += 2      # capability flags (lower)
        off += 1                                        # character set
        off += 2                                        # status flags
        server_caps |= _u16(payload, off) << 16; off += 2   # capability flags (upper)
        auth_data_len = _u8(payload, off); off += 1
        off += 10                                       # reserved
        salt += payload[off:off + max(13, auth_data_len - 8) - 1]  # part 2 (drop trailing NUL)
        off += max(13, auth_data_len - 8)

View on GitHub (pinned to 0a35b20e39)

When it happens

Trigger: Thrown at extra/dbwire/mysql.py:289 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/4272b354dbd07906. Report an issue: GitHub.