MySQL text file import and batch processing mode Application Description bitsCN.com
1. Load Records in text files into mysql database tables (1) text file format: one record per line. The field values are separated by the tab operator. The field order is the same as the order in the table definition. uncertain field values are represented by/N;
(2) load data local infile 'pet.txt 'into table pet;
Note: if the windows editor is used, use:
Load data local infile 'pet.txt 'into table pet
Lines terminated by '/r/N ';
Run mysql in 2 batches (1 put the mysqlsyntax to be run in a batch file batch-file.txt;
(2) execution: mysql-h host-u user-p <batch-file.txt;
(3.txt redirects the output to the out.txt file:
Mysql-h host-u user-p <batch-file.txt> out.txt;
Run the script from the mysql prompt:
Mysql> source batch-file.txt; or mysql>/. batch-file.txt; bitsCN.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.