MySql bulk load command line tool

Mike Q picture Mike Q · Oct 26, 2009 · Viewed 18.7k times · Source

Does MySql have a bulk load command line tool like bcp for SQLServer and sqlldr for Oracle? I know there's a SQL command LOAD INFILE or similar but I sometimes need to bulk load a file that is on a different box to the MySQL database.

Answer

ʞɔıu picture ʞɔıu · Oct 26, 2009

mysqlimport.

takes the same connection parameters as the mysql command line shell. Make sure to use the -L flag to use a file on the local file system, otherwise it will (strangely) assume the file is on the server.

There is also an analogous variant to the load data infile command, i.e., load data local infile, according to which the file will be loaded from the client rather than the server, which may accomplish what you want to do.