1. The show ERRORS statement simply displays the error of the previous statement and does not display both warnings and considerations.
As an example:
The code is as follows |
Copy Code |
Mysql> Show DFDAFSADF ->; Error 1064 (42000): You have a error in your SQL syntax; Check the manual that Corresponds to your MySQL server version for the right syntax to use near ' Dfdaf SADF ' at line 1 |
There's a mistake here. about how to show her, it's already obvious.
The code is as follows |
Copy Code |
Mysql> Show Errors -> G 1. Row *************************** Level:error code:1064 Message: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 ' dfdafsadf ' at Li NE 1 1 row in Set (0.00 sec) |
If there are a lot of mistakes, and you want to show only the second one:
Show Errorw limit 1, 1;
If you want to see the number of errors, the previous 1 rows in set is already obvious.
But there are ways:
The code is as follows |
Copy Code |
Mysql> Show Count (*) errors; +-----------------------+ | @ @session. Error_count | +-----------------------+ | 1 | +-----------------------+ 1 row in Set (0.00 sec)
|
Note: The Count (*) here cannot be written as count (1).
You can also do this:
The code is as follows |
Copy Code |
Mysql> SELECT @ @error_count; +---------------+ | @ @error_count | +---------------+ | 1 | +---------------+ 1 row in Set (0.00 sec) |
2. Show warnings displays the error, warning, and attention of the previous statement.
The basic syntax is similar to show errors.
Note, however, that most of the previous warnings after MYSQL5 were directly displayed as errors
The MySQL warning is easy to read, and it's easy to modify the table when you have a warning message.
In the warning above,
The first warning is that the field is not long enough to import data that is automatically cropped by the system;
The second is that the character set of the data is incorrect, for the second, the TXT encoding format that needs to modify the character set of the database or import the data;
The third is to insert blank data, which can be ignored if the field allows null values;
The fourth one is that the imported data has one column superfluous.