MYsql Data Text Export and Import

Source: Internet
Author: User

MYsql Data Text Export and Import I. query the table structure mysql> desc province; + ----------- + ------------- + ------ + ----- + --------- + ---------------- + | Field | Type | Null | Key | Default | Extra | + ----------- + ------------- + ------ + ----------- + ---------------- + | id | int (11) | NO | PRI | NULL | auto_increment | name | varchar (32) | NO | NULL | countryId | int (11) | YES | MUL | NULL | + ----------- + ------ + ----- + -- The data in the --------------------+、table is exported as the example file (.txt). The SQL code select id, name, countryId into outfile "d:/data_out.txt" lines terminated by "\ r \ n" from province; export result: 1 Beijing 12 Shanghai 13 Tianjin 14 Chongqing 15 Heilongjiang 16 Jilin 17 Liaoning 1 ...... Iii. Import a text file to the Database SQL code load data local infile "d:/data_out.txt" into table t_province (id, name); import result: mysql> select * from t_province; + ---- + -------- + | id | name | + ---- + -------- + | 1 | Beijing | 2 | Shanghai | 3 | Tianjin | 4 | Chongqing | 5 | Heilongjiang |

Related Article

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.