MySQL command to import and export data table records (select load data)

Source: Internet
Author: User
Tags mysql index

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.