Import the data in the text file to the mysql database.
For example, import the data in the text file to the mysql database.
My own implementations can be divided into several types:
1. Write the programming language you are good at to read and write files, connect to the database, and write;
2. Run the SQL script statement in mysql for import.
The first one will not be mentioned now. It is simple.
Now let's talk about how to directly import the. text File Using SQL statements.
1. First, create a new table in the database (the table here must at least match the fields in your data, that is, the number of fields in a row );
2. Run the SQL script statement:
For example, your file is D:/field.txt; the database table name is field; the fields in the text file are separated by tabs (\ t;
Load data infile 'd:/field.txt 'into table field fields terminated by '\ t' lines terminated by' \ N'
Click execute to obtain the data.
After the table is created, the count value is 0.
After running the mysql script statement
Import Data count
Record here for future use.