0

I have a large CSV file that's 100G and has 180 million rows. I need to import this file into MariaDB.

I used mysqlimport, and after three hours of running I get error 2013. If I run a select on the table after the error is thrown, the table is empty.

How to upload a very large file in MariaDB? How to fix this problem?

C:\Users\pgsch\Downloads>mysqlimport --verbose --local -u user01 -p bank_0001_test fm_loans fm_loans  --fields-terminated-by="|"
Enter password: ********
Connecting to localhost
Selecting database bank_0001_test
Loading data from LOCAL file: C:/Users/pgsch/Downloads/fm_loans into fm_loans
mysqlimport: Error: 2013, Lost connection to MySQL server during query, when using table: fm_loans
ps0604
  • 1,227
  • 23
  • 133
  • 330

1 Answers1

0

There are three likely causes for this error message:

  1. Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently
  2. Sometimes the “during query” form happens when millions of rows are being sent as part of one or more queries.
  3. More rarely, it can happen when the client is attempting the initial connection to the server

For more details read

Cause 1 : set global max_allowed_packet=101000000000; (101 GB) Set maximum allowed packet size to a large byte number.The default value may throw errors for such large data files.

Cause 2 : SET GLOBAL interactive_timeout=60; from its default of 30 seconds to 60 seconds or longer

Cause 3 : SET GLOBAL connect_timeout=60;

Additional reference:

  1. Error Code: 2013. Lost connection to MySQL server during query
  2. https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html
  3. https://mariadb.com/docs/reference/mdb/system-variables/interactive_timeout/
  4. https://manios.org/2013/03/19/import-a-large-sql-dump-file-to-a-mysql-database-from-command-line
Vishal K
  • 1,368
  • 1
  • 7
  • 15