Inserting large amount of data into mysql. Out of memory

I have
"insert into $1 (decimal x 4, int x 2) values ("
in a text file, and do
cat insert-command values-file > file2
mysql < file2

This works well with smaller files, but dies with:
ERROR 5 (HY000) at line 13: Out of memory (Needed 2579824 bytes)
on a file about 130mb.
Any suggestions on how to work around this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Have you tried changing configurations in mysql configuration file. Try changing values of

letharionAuthor Commented:
First I tried to raise all tenfold, which made the "needed" value fall a bit lower.
I reverted and starting changing key_buffer_size, and noticed that it made a difference.
If I push it up to 2000M, the error message changes to:

ERROR 2006 (HY000) at line 13: MySQL server has gone away
letharionAuthor Commented:
Googling indicates that max_packet_size might be relevant. It's set to 64 on both client and server.
letharionAuthor Commented:
I gave it a try and raised the value to 640 on both sides. The query seems to take a while longer before it fails, but still does so.
letharionAuthor Commented:
I just chopped the data up with split and scripted several inserts.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.