ASPECT #1
This sounds like you are suffering from a classic case of bulk insert buffering. (Forgive me if I sound like a doctor). LOAD DATA INFILE takes advantage of a tree-structured bulk insert buffer. The size is set by the option bulk_insert_buffer_size.
Please note what that part of the Documentation says:
MyISAM uses a special tree-like cache to make bulk inserts faster for INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA INFILE when adding data to nonempty tables. This variable limits the size of the cache tree in bytes per thread. Setting it to 0 disables this optimization. The default value is 8MB.
This being the case, the setting for bulk_insert_buffer_size is too small.
Increase it on the server dynamically with
SET GLOBAL bulk_insert_buffer_size = 1024 * 1024 * 1024;
for all incoming sessions.
For you current session, run
SET bulk_insert_buffer_size = 1024 * 1024 * 1024;
That's a 1G maximum setting.
Then, go add this to /etc/my.cnf
[mysqld]
bulk_insert_buffer_size=1G
ASPECT #2
Since the table is MyISAM, why make mysqld jump through hoops to regenerate the table ???
If the table is mydb.mytable
and your datadir is /var/lib/mysql
, copy these
/var/lib/mysql/mydb/mytable.frm
/var/lib/mysql/mydb/mytable.MYD
/var/lib/mysql/mydb/mytable.MYI
to the other server's /var/lib/mysql/mydb
After copying it, remember to change the file ownership
cd /var/lib/mysql/mydb
chown mysql:mysql mytable.*
ASPECT #3
Since you are loading a MyISAM table, there may be indexes to account for. You should do this
use mydb
ALTER TABLE mytable DISABLE KEYS;
LOAD DATA INFILE ... INTO mytable ... ;
ALTER TABLE mytable ENABLE KEYS;
This will disable non-unique indexes, load the data and fill the .MYI
with the Primary Key and Unique Indexes. The ENABLE KEYS phase will linearly build all non-unique indexes. That should speed things up.