mariadb - "ERROR 2013 (HY000): Lost connection to MySQL server during query" while loading data -


i getting error when try load data mysql (mariadb actually) table using load data command:

load data local infile '/tmp/my_data.tsv'  table my_schema.my_table fields terminated '\t'  optionally enclosed '"' escaped '\\' lines terminated '\n'; 

trying solutions given here , here did not work.

for reason, mysql gives obscure error message when data loading breaks foreign key constraint (described in more detail here).

i managed correct error message executing load data command directly command line. i.e. running:

mysql -u username -p --local-infile --execute= \ "load data local infile '/tmp/my_data.tsv' table my_schema.my_table \ fields terminated '\t' optionally enclosed '\"' escaped '\\\\';" 

gave error message:

cannot add or update child row: foreign key constraint fails  (`my_schema`.`my_table`, constraint `other_table` foreign key (`id`) references `other_table` (`id`)) 

after removing rows violated foreign key constraint, able import data.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -