Deny MySQL warnings?

Let's say I run a query that triggers some warning messages:

eg:
DROP TABLE IF EXISTS "abcd";

Is there a way to suppress only the warning message that started?

I see that there is a max_error_count "system variable, changing it to zero may ignore warnings, but it will also make all errors / notice messages.

+1
mysql suppress-warnings
Dec 23 '14 at 8:23
source share
1 answer

Perhaps the sql_notes variable will help you in solving this problem. Quote from manpage:

The sql_notes system variable manages note messages increment warning_count and whether the server saves them. From default, sql_notes is 1, but if set to 0, the notes do not increase warning_count and the server does not save them:

 mysql> SET sql_notes = 1; mysql> DROP TABLE IF EXISTS test.no_such_table; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> SHOW WARNINGS; +-------+------+------------------------------------+ | Level | Code | Message | +-------+------+------------------------------------+ | Note | 1051 | Unknown table 'test.no_such_table' | +-------+------+------------------------------------+ 1 row in set (0.00 sec) mysql> SET sql_notes = 0; mysql> DROP TABLE IF EXISTS test.no_such_table; Query OK, 0 rows affected (0.00 sec) mysql> SHOW WARNINGS; Empty set (0.00 sec) 
+5
Dec 23 '14 at 8:28
source share



All Articles