View the MySQL warnings warning Error statement

Source: Internet
Author: User
Tags character set manual

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.