LOAD DATA INFILE 'sample.csv' IGNORE INTO TABLE mytable;
Result is ok, but each row logs a warning:
| Warning | 1261 | Row 1 doesn't contain data for all columns |
| Warning | 1261 | Row ... doesn't contain data for all columns |
| Warning | 1261 | Row 20000000 doesn't contain data for all columns |
But I'm fine with the import and even want to prevent the warning logs (eg they might impact performance). How can I disable those explicit?
While this isn't the ideal solution you could disable logging warnings for the database. You could try use
SET GLOBAL LOG_WARNINGS = 0
to turn off logging and
SET GLOBAL LOG_WARNINGS = 1
to turn it back on.
Maybe run this before you load your file and then switch it back on afterwards.
UPDATE: LOG_WARNINGS is deprecated so you can use this:
SET GLOBAL log_error_verbosity = 1;
which will only log errors. You can set the value to 3 (default value) afterwards.
Here is a reference: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_error_verbosity