The use of the following methods:
Copy Code code as follows:
Mysql>load data local infile "d:/ab.txt" into table Mytbl (name,age);
Using the commands above, you can import the contents of the D:/ab.txt file into the table mytbl, where name and age are the fields of the table mytbl, corresponding to the data for each row in the Ab.txt file. If you compile and install MySQL without specifying
–enable-local-infile, the following error will be reported when using the above command:
Copy Code code as follows:
ERROR 1148 (42000): The used command isn't allowed with this MySQL version
There are two solutions, one is to recompile the installation plus the above parameters, but directly with the command line execution, as follows:
Copy Code code as follows:
Mysql-uroot-proot mydb_name--local-infile=1-e ' load data local infile ' d:/ab.txt to Table Mytbl (name,age) '
Test A, import 3 million data, the use of the load data command time spent about 3 minutes, or very good!