MySQL Data export Import

Source: Internet
Author: User

1. Import the TXT file from MySQL query data

mysql-h 10.3.20.251-u addata_r-p 3417-parreboehw9mijien_ep6bykoxktikunl ad_data-e "SELECT ID, Advertiser_id,date,cos t,0 as Cash_cost, 0 as Reward_cost, 0 as Return_goods_cost, Income,balance, Create_time, Ad_count, ' show ', Click,deal_base, ' Grant ', Compensation,frozen,transfer_out,transfer_in,income_all, Date_format (DATE, '%y%m%d ') as ' datetime ' from daily_accounting_new where date>= ' 2017-11-27 ' and date<= ' 2018-03-12 ' ">/home/chenxiaolong.rd/repos/test/ Daily_accounting_new.txt

2. Import the file data exported from the first step into MySQL

Mysqlimport-h 101.3.20198- u aad_plat_w-p 3884 -ptest_pwd --local ad_plat/home/chenxiaolong.rd /repos/test/daily_accounting_new.txt

This applies to the TXT file field and the imported library field one by one corresponding to the case, if not corresponding, you can try similar to the following command

Mysqlimport-h 127.0.0-u root-p-p8731787


3. If you are conducting data from hive to MySQL, write the SQL statement to the file, then the command line executes hive-f hive.sql > Data.txt, and then the same as the second step


Attention?? : The exported file name needs to be the same as the name of the imported table, such as Daily_accounting_new.log, suffix is ok (I do not know why, the table name is not specified in the command)


The above command is an incremental import, if you do not change the TXT file, two times the same import command, the MySQL library data is unchanged, if you change the TXT data, MySQL will add the changed data, the same data will not change


MySQL Data export Import

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.