MySQL: Enable LOAD DATA LOCAL INFILE

后端 未结 18 1342
北海茫月
北海茫月 2020-11-22 09:30

I\'m running Mysql 5.5 on Ubuntu 12 LTS. How should I enable LOAD DATA LOCAL INFILE in my.cnf?

I\'ve tried adding local-infile in my config at various places but I\'

18条回答
  •  时光取名叫无心
    2020-11-22 09:50

    Another way is to use the mysqlimport client program.

    You invoke it as follows:

    mysqlimport -uTheUsername -pThePassword --local yourDatabaseName tableName.txt
    

    This generates a LOAD DATA statement which loads tableName.txt into the tableName table.

    Keep in mind the following:

    mysqlimport determines the table name from the file you provide; using all text from the start of the file name up to the first period as the table name. So, if you wish to load several files to the same table you could distinguish them like tableName.1.txt, tableName.2.txt,..., etc, for example.

提交回复
热议问题