Finding MySQL Errors from LOAD DATA INFILE

I run the LOAD DATA INFILE command in MySQL, and one of the files shows errors at the mysql prompt.

How to check warnings and errors? Right now, the only thing I need to do is that the request reports 65535 import warnings.

mysql> use dbname;
Database changed
mysql> LOAD DATA LOCAL INFILE '/dump.txt'
    -> INTO TABLE table
    -> (id, title, name, accuracy);
Query OK, 897306 rows affected, 65535 warnings (16.09 sec)
Records: 897306  Deleted: 0  Skipped: 0  Warnings: 0

How do I get mysql to show me what these warnings are? I looked through the error log but could not find them. Running the SHOW WARNINGS command returns only 64 results, which means that the remaining 65,000 warnings should be somewhere else.

2 |
| Warning | 1366 | Incorrect integer value: '' for column 'accuracy' at row 2038
3 |
| Warning | 1366 | Incorrect integer value: '' for column 'accuracy' at row 2038
4 |
| Warning | 1366 | Incorrect integer value: '' for column 'accuracy' at row 2038
6 |
| Warning | 1366 | Incorrect integer value: '' for column 'accuracy' at row 2038
7 |
+---------+------+--------------------------------------------------------------
--+
64 rows in set (0.00 sec)

How to find these errors?

+3
source share
3 answers

, .

, accuracy - , , .

awk , .

+1

MySQL SHOW WARNINGS . , max_error_count.

+5

, , MySQL .

, ,

[{FIELDS | COLUMNS}
    [TERMINATED BY 'string']
    [[OPTIONALLY] ENCLOSED BY 'char']
    [ESCAPED BY 'char']
]
[LINES
    [STARTING BY 'string']
    [TERMINATED BY 'string']
]

tablename .

- :

LOAD DATA LOCAL INFILE '/dump.txt' Table INTO TABLE fields completed with '', optionally enclosed in '' '(id, name, name, accuracy);

By default, if you do not specify this, MySQL expects the tab character to complete the fields.

0
source

Source: https://habr.com/ru/post/1718730/


All Articles