projectdiscovery/nuclei · warning
not a mysql service
Error message
not a mysql service
What it means
Returned by MySQLClient.Connect after its IsMySQL probe returned false without an underlying fingerprint error (parse failures propagate as errors instead). It means the fingerprint handshake completed but the service did not identify as MySQL, so Connect refuses to build a DSN and attempt credentials. It is a guard that avoids sending MySQL auth to a non-MySQL service.
Source
Thrown at pkg/js/libs/mysql/mysql.go:73
// ```javascript
// const mysql = require('nuclei/mysql');
// const client = new mysql.MySQLClient;
// const connected = client.Connect('acme.com', 3306, 'username', 'password');
// ```
func (c *MySQLClient) Connect(ctx context.Context, host string, port int, username, password string) (bool, error) {
executionId := ctx.Value("executionId").(string)
if !protocolstate.IsHostAllowed(executionId, host) {
// host is not valid according to network policy
return false, protocolstate.ErrHostDenied.Msgf(host)
}
// executing queries implies the remote mysql service
ok, err := c.IsMySQL(ctx, host, port)
if err != nil {
return false, err
}
if !ok {
return false, fmt.Errorf("not a mysql service")
}
dsn, err := BuildDSN(MySQLOptions{
Host: host,
Port: port,
DbName: "INFORMATION_SCHEMA",
Protocol: "tcp",
Username: username,
Password: password,
})
if err != nil {
return false, err
}
return memoizedconnectWithDSN(ctx, executionId, dsn)
}
type (
// MySQLInfo contains information about MySQL server.View on GitHub (pinned to 265b3a3dec)
Solutions
- Verify host:port is MySQL before calling Connect (e.g. call mysql.IsMySQL yourself and branch on the result)
- Fix the port — most often the service simply is not on the port the template assumed
- In template logic, treat this error as 'skip target' rather than a failure
- If the target is MySQL-compatible but non-standard, use the code protocol and a raw driver instead of this library
Example fix
// before
const ok = client.Connect('acme.com', 3306, 'root', 'pass');
// after
if (mysql.IsMySQL('acme.com', 3306)) {
const ok = client.Connect('acme.com', 3306, 'root', 'pass');
} else {
log('skipping: not mysql');
} Defensive patterns
Strategy: validation
Validate before calling
if (mysql.IsMySQL(host, port)) {
const ok = client.Connect(host, port, user, pass);
} else {
log('skip non-mysql target');
} Try / catch
try { client.Connect(host, port, user, pass); } catch (e) { if (String(e) === 'not a mysql service') { /* skip target */ } else { throw e; } } Prevention
- Gate Connect with IsMySQL once per host:port (results are memoized)
- Maintain an accurate port map so templates hit real MySQL ports
- Treat negative service checks as control flow, not errors
- Log skipped targets separately from failures for triage
When it happens
Trigger: Calling client.Connect('host', port, user, pass) where host:port is not a MySQL service (wrong port, another database, or the memoized probe cached a negative result). Note Connect also runs the network-policy check first, so a denied host surfaces as ErrHostDenied, not this.
Common situations: Brute-force or cred-check templates pointed at a port list; targets where 3306 is mapped to something else in Docker/K8s; typos in host/port; template assumes MySQL but target migrated to another engine.
Related errors
- empty mysql greeting
- invalid mysql packet length %d
- mysql handshake packet too short
- mysql handshake packet length out of range
- unsupported mysql protocol version
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/5a0c67fdd5069cff.
Report an issue: GitHub.