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