如何显示刚刚发生的 MySQL 警告?
要显示 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)
广告