MySql bulk load command line tool

半世苍凉 提交于 2019-11-27 08:30:27

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.

LOAD DATA LOCAL INFILE 'C:\\path\\to\\windows\\file.CSV'
INTO TABLE table_name
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, field2, field3, fieldx);

I'm think mysqlimport may help?

Loads tables from text files in various formats. The base name of the text file must be the name of the table that should be used. If one uses sockets to connect to the MySQL server, the server will open and read the text file directly. In other cases the client will open the text file. The SQL command 'LOAD DATA INFILE' is used to import the rows.

mysql -u root -p
use database;
source /path/yourfile.sql

Might be what you are looking for, you can use rsync via ssh to transfert the 'bulk file' from a machine to another.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!