mysqldockerrdsload-data-infile

Getting "Lost connection to MySQL server during query" during "Load data local infile" in Docker/RDS


I am encountering a really weird issue when running LOAD DATA LOCAL INFILE from a Docker container. The file that I am trying to load is essentially a single row file with 3 columns none of which are big.

As soon as I hit enter for the below command:
LOAD DATA LOCAL INFILE '/tmp/small_file.txt' INTO TABLE Some_Table COLUMNS TERMINATED BY '\t' lines terminated BY '\n' IGNORE 1 LINES;

I get the error:

ERROR 2013 (HY000): Lost connection to MySQL server during query

The next query I run gives the message:

ERROR 2006 (HY000): MySQL server has gone away   
No connection. Trying to reconnect...  
Connection id:    4082  
Current database: Some Database

Some important differences between other questions which have similar issues and the issue I am facing are:

  1. The file is tiny, it could not have exceed the default max_allowed_packet
  2. There is no delay between the time the I hit the enter key and the time when the error message shows up, its instantaneous
  3. Other regular select queries run fine
  4. This happens only inside the Docker container(FROM php:5.6-apache), not in the host system which is a Mac

Interestingly enough, a container running from the same image in a AWS EC2 instance does not face issue, which leads me to believe it's more of a networking/configuration issue. Any pointers on how I should debug this?

Edit: The MySQL server is AWS RDS MySQL


Solution

  • We had the same problem (tiny file, no delay, other queries OK). We found that Intrusion Prevention System blocked the connection.