MySQL command to import and export data table records (select load data)
MySQL Database Import and Export commands commonly use mysqldump source commands. This article shares a different and more convenient way to import and export data.
(1) Export data
A. Use the default path
Select * from data table name into outfile 'example name .txt ';
Example:
/* Export the data in the phpernotetable and save it to the c Directory, which is the phpernote.txt file */select * from phpernote into outfile 'C: \ phpernote.txt ';
B. Specify the storage path
Select * from data table name into outfile 'd: \ your name .txt ';
C. Export the specified fields in the data table
Select field name 1, field name 2 · from data table name into outfile 'example name .txt ';
(2) import data
A. The record contains all fields of the data table.
Load data infile 'your name. txt path 'into table data table name; import record contains all fields
B. The record contains the specified fields in the data table.
Load data infile 'external name .txt 'into table data table name (field name 1, field name 2 ···)
Note: the sorting of field names should be consistent with the sorting of exported specified field names.
Articles you may be interested in
- MySQL uses commands to import and export instances for. SQL file backup data operations
- MySQL Data Table for Chinese provinces and municipalities
- Methods for resetting the auto-increment start value of various MySQL Data Table types
- How does mysql export data of a field in a table?
- How to query data of mysql today, yesterday, last 7 days, last 30 days, last month, and last month
- PHP compresses html webpage code to reduce the amount of network data transmitted, clear spaces, tabs, and comment mark
- URL encoding functions such as urlencode (), urldecode (), rawurlencode (), and rawurldecode ()
- MySQL index Operation Command (create index, re-index, query index, delete index) Summary