MySQL Error number: 3012; Symbol: ER_EXPLAIN_NOT_SUPPORTED; SQLSTATE: HY000

文档解释

Error number: 3012; Symbol: ER_EXPLAIN_NOT_SUPPORTED; SQLSTATE: HY000

Message: EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE

错误说明:

ER_EXPLAIN_NOT_SUPPORTED 错误指示MySQL不支持 EXPLAIN 命令。

常见案例

在MySQL终端运行EXPLAIN语句时可能会出现此错误:

mysql> EXPLAIN SELECT * FROM Table;

ERROR 3012 (HY000): EXPLAIN not supported

解决方法:

在MySQL 5.7和更高版本中,EXPLAIN语句必须加入EXPLAIN FORMAT = JSON参数才能正确工作。因此,正确的语句格式是:

mysql> EXPLAIN FORMAT=JSON SELECT * FROM Table;

你可能感兴趣的