Title, import the data from the text file into the MySQL database.
My own specific implementation can be divided into several:
1, write your good programming language to read and write files, and then connect to the database, write;
2. Run SQL script statements directly in MySQL and import them.
The first one is now no longer said, simple.
Let's talk about how to import the. text file directly from the SQL statement.
1. First create a new table in the database (the table here must match the field in your data, that is, the number of fields that exist on a row);
2. Run the SQL script statement:
For example: your file is d:/field.txt; The database table name is field; The field in the text file is separated by a tab (\ t);
LOAD DATA INFILE ' d:/field.txt ' into TABLE field fields TERMINATED by ' \ t ' LINES TERMINATED by ' \ n '
Click Execute to get the data.
New post table count is 0
After running the MySQL script statement
Import data Count
This is recorded for later needs.
Import data from the text file into the MySQL database