
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to suppress warnings in MySQL?
To suppress warnings, set SQL_NOTES=0. Let us see an example.
At first, we will set SQL_NOTES to 1 −
mysql> SET sql_notes = 1; Query OK, 0 rows affected (0.00 sec)
Now, let us drop a table which does not exist. As you can see a warning message is now visible −
mysql> drop table if exists web.DemoTable; Query OK, 0 rows affected, 1 warning (0.07 sec)
To look at the above warning message, you need to just use the SHOW WARNINGS command −
mysql> show warnings;
This will produce the following output displaying the warning message −
+-------+------+-----------------------------------+ | Level | Code | Message | +-------+------+-----------------------------------+ | Note | 1051 | Unknown table 'web.DemoTable' | +-------+------+-----------------------------------+ 1 row in set (0.00 sec)
Now, since we need to suppress warnings, use SQL_NOTES and set it to OFF −
mysql> SET sql_notes = 0; Query OK, 0 rows affected (0.00 sec)
Let us drop the above table once again −
mysql> drop table if exists web.DemoTable; Query OK, 0 rows affected (0.07 sec)
The above process is called suppress warning in MySQL. Now, when you will again try to fetch the warnings, it will display “Empty set” as shown below −
mysql> show warnings; Empty set (0.00 sec)
- Related Articles
- How to suppress MySQL stored procedure output?
- How to suppress Matplotlib warning?
- How to suppress jQuery event handling temporarily?
- How to remove fake JavaScript pop-up messages and warnings?
- How to suppress a binary file matching results in grep on Linux?
- Key Employee – Definition, Rules & Warnings
- Tattoo Ink - Allergic Reaction Warnings
- What is the diet to suppress appetite?
- How to suppress Android notification on lock screen but let it be in notification area?
- What is a Diuretic? Uses, Warnings, Side Effects
- Suppress whole columns of a 2-D array that contain masked values in Numpy
- Suppress whole rows of a 2-D array that contain masked values in Numpy
- Suppress only rows that contain masked values using compress_rowcols() along specific axis in Numpy
- Suppress only columns that contain masked values using compress_rowcols() along specific axis in Numpy
- How to store decimal in MySQL?

Advertisements