MyCATApache/Mycat-Server · warning

ER_SYNTAX_ERROR

ER_SYNTAX_ERROR

Error message

Unsupported command

What it means

The default branch of ServerQueryHandler.query's command switch: any command code that reached the server but has no case in the dispatcher (an unknown or not-yet-implemented MySQL command) falls through to here. The server logs 'Unsupported command:' with the SQL at WARN level and writes an ER_UNKNOWN_COM_ERROR error packet containing this message back to the client. It is a generic protocol-level rejection, not a SQL semantics error — the connection remains usable and subsequent valid commands are dispatched normally.

Solutions

  1. Do not use HELP through MyCat; consult MySQL/MyCat documentation directly.
  2. Connect to the backend MySQL for server-side HELP.
  3. Avoid '?' shortcut in mysql CLI or run against a direct MySQL connection.

Example fix

// before
HELP SELECT;
// after
-- consult docs; run HELP against backend MySQL, not MyCat
Defensive patterns

Strategy: validation

Validate before calling

// Avoid HELP statements through MyCat
if (sql.trim().toUpperCase().startsWith("HELP")) {
    throw new UnsupportedOperationException("HELP is unsupported through MyCat");
}

Try / catch

try {
    stmt.execute(sql);
} catch (SQLException e) {
    if (e.getErrorCode() == 1064 /* ER_SYNTAX_ERROR */ && e.getMessage().contains("Unsupported command")) {
        log.info("HELP not supported by MyCat; skipping");
    }
}

Prevention

When it happens

Trigger: Client sends 'HELP <topic>' or the mysql CLI protocol-level HELP request through MyCat.

Common situations: Interactive mysql client sessions (client sends HELP on '?' input); admin scripts probing server capabilities.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/cb570be2364106b8. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/server/ServerQueryHandler.java:125

		case ServerParse.KILL:
			KillHandler.handle(sql, rs >>> 8, c);
			break;
		//不支持KILL_Query
		case ServerParse.KILL_QUERY:
			LOGGER.warn(new StringBuilder().append("Unsupported command:").append(sql).toString());
			c.writeErrMessage(ErrorCode.ER_UNKNOWN_COM_ERROR,"Unsupported command");
			break;
		case ServerParse.USE:
			UseHandler.handle(sql, c, rs >>> 8);
			break;
		case ServerParse.COMMIT:
			c.commit();
			break;
		case ServerParse.ROLLBACK:
			c.rollback();
			break;
		case ServerParse.HELP:
			LOGGER.warn(new StringBuilder().append("Unsupported command:").append(sql).toString());
			c.writeErrMessage(ErrorCode.ER_SYNTAX_ERROR, "Unsupported command");
			break;
		case ServerParse.MYSQL_CMD_COMMENT:
			c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
			break;
		case ServerParse.MYSQL_COMMENT:
			c.write(c.writeToBuffer(OkPacket.OK, c.allocate()));
			break;
        case ServerParse.LOAD_DATA_INFILE_SQL:
			if(RouteService.isHintSql(sql) > -1){ // 目前仅支持注解 datanode,原理为直接将导入sql发送到指定mysql节点
				c.execute(sql , ServerParse.LOAD_DATA_INFILE_SQL);
			}else{
				c.loadDataInfileStart(sql);
			}
			break;
		case ServerParse.MIGRATE: {
		    try {
                MigrateHandler.handle(sql, c);

View on GitHub (pinned to 65f8d8beb7)