要显示MySQL警告,可以使用以下语法-
SHOW WARNINGS;
上面的语法仅显示来自MySQL提示符的立即警告。假设您在它们之间运行了另一个查询,或者您失去了MySQL连接,那么SHOW WARNINGS将不起作用。
这是显示警告的查询-
mysql> SHOW WARNINGS;
这是显示立即警告的输出-
+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Error | 1064 | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'QUERY CACHE' at line 1 | +-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)