Home > database >  The LOAD DATA LOCAL INFILE derivative according to to mysql queries from TXT document
The LOAD DATA LOCAL INFILE derivative according to to mysql queries from TXT document

Time:09-18

Hello, I recently faced a demand, no experience, before his to consult everybody,

In simple terms, we applied now have a users table, a card table, now have a project to cut, need data migration, but the two sides do not match the table structure itself, cannot be derived from the original table SQL statement to import to the target table,

Today I saw some information want to try the LOAD DATA INFILE way, I got a small amount of test DATA, under the local database to get the script, found to be capable of migrating smooth realization, but some confused problems in the process of:

1. My local environment is Windows,
(1) in the LOAD DATA LOCAL INFILE behind is written 'D: \ \ Users \ \ XXXX \ \ Desktop \ \ data_transfer_demo \ \ user_info TXT' this kind of path,
(2) LINES TERMINATED BY written '\ r \ n' here is the form of \ r \ n
(3) and run recompense security Settings for the first time, then in my. Ini file added secure_file_priv=after restart mysql,

We have a jumping machine, Windows, and even the production environment, with navicat inside, but I see the secure_file_priv=NULL. This do? You must restart mysql production?

(2) is about the performance, I this requirement, the user table and the table is the amount of 300000, I found that when the machine test, the user table insertion speed are ok, but the CARDS on the table since the business requires that a field of a need to get original data to the user list to check the other fields, with the seed needed information query manner, then inserted into a card table, this is equivalent to each card table record when inserted to traverse the users table, it must take long, is there any optimization means?
  • Related