{"record":{"id":"d8e09aee58c26a75","repo":"alibaba/canal","slug":"command-showsql-has-an-error-pls-check","errorCode":null,"errorMessage":"command : ' + showSql + ' has an error! pls check. you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation","messagePattern":"command : ' \\+ showSql \\+ ' has an error! pls check\\. you need \\(at least one of\\) the SUPER,REPLICATION CLIENT privilege\\(s\\) for this operation","errorType":"exception","errorClass":"CanalParseException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java","lineNumber":679,"sourceCode":"    }\n\n    /**\n     * 查询当前的binlog位置\n     */\n    private EntryPosition findEndPosition(MysqlConnection mysqlConnection) {\n        String showSql = \"show master status\";\n        try {\n            if (mysqlConnection.atLeastMySQL84()) {\n                // 8.4新语法\n                showSql = \"show binary log status\";\n            } else if (multiStreamEnable) {\n                // 兼容polardb-x的多流binlog\n                showSql = \"show master status with \" + destination;\n            }\n            ResultSetPacket packet = mysqlConnection.query(showSql);\n            List<String> fields = packet.getFieldValues();\n            if (CollectionUtils.isEmpty(fields)) {\n                throw new CanalParseException(\n                    \"command : '\" + showSql + \"' has an error! pls check. you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation\");\n            }\n            EntryPosition endPosition = new EntryPosition(fields.get(0), Long.valueOf(fields.get(1)));\n            if (isGTIDMode() && fields.size() > 4) {\n                endPosition.setGtid(fields.get(4));\n            }\n            // MariaDB 无法通过`show master status`获取 gtid\n            if (mysqlConnection.isMariaDB() && isGTIDMode()) {\n                ResultSetPacket gtidPacket = mysqlConnection.query(\"SELECT @@global.gtid_binlog_pos\");\n                List<String> gtidFields = gtidPacket.getFieldValues();\n                if (!CollectionUtils.isEmpty(gtidFields) && gtidFields.size() > 0) {\n                    endPosition.setGtid(gtidFields.get(0));\n                }\n            }\n            return endPosition;\n        } catch (IOException e) {\n            throw new CanalParseException(\"command : '\" + showSql + \"' has an error!\", e);\n        }","sourceCodeStart":661,"sourceCodeEnd":697,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L661-L697","documentation":"findEndPosition() runs `show master status` (or `show binary log status` on MySQL 8.4, or multi-stream variant for PolarDB-X). If the field list is empty, Canal treats it as a privilege failure and throws CanalParseException requesting SUPER / REPLICATION CLIENT, because an empty result means the session cannot see binary log status.","triggerScenarios":"The account cannot view binary log status — `show master status` returns no rows because binary logging is off, or the user lacks REPLICATION CLIENT privilege to see it.","commonSituations":"Binary logging disabled on the master (log_bin=OFF); canal user missing REPLICATION CLIENT; connecting to a read-only replica without binlog; MySQL 8.4 where the command changed to `show binary log status` but privileges still missing.","solutions":["Grant REPLICATION CLIENT (and SUPER where required): `GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';`.","Confirm binary logging is enabled: `SHOW VARIABLES LIKE 'log_bin';` must be ON and `SHOW MASTER STATUS;` returns a row.","On MySQL 8.4+, ensure the atLeastMySQL84() detection is correct so `show binary log status` is used."],"exampleFix":"GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';\nFLUSH PRIVILEGES;\n-- verify\nSHOW MASTER STATUS;  -- or SHOW BINARY LOG STATUS; on 8.4","handlingStrategy":"validation","validationCode":"// Pre-flight master status visibility\nResultSetPacket rs = connection.query(showSql);\nif (rs == null || CollectionUtils.isEmpty(rs.getFieldValues())) {\n    throw new IllegalStateException(\"Empty result for \" + showSql + \"; grant REPLICATION CLIENT and confirm log_bin=ON.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grant REPLICATION CLIENT (and SUPER where required) to the canal user.","Confirm log_bin=ON and SHOW MASTER STATUS returns a row.","On MySQL 8.4, ensure version detection routes to `show binary log status`."],"tags":["mysql","privilege","binlog","master-status","metadata-query","canal-parse"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}