Search code examples
mysqlcsvimportscheduled-taskswindows-task-scheduler

How to import a CSV with Windows Task Scheduler or schedule a task using the command prompt


I could run the following command:

mysql.exe -u root

use testdb

LOAD DATA INFILE 'C:/Users/user1/test.csv' INTO TABLE demo FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

under c:\xampp\mysql\bin

How could I run the above command as a batch file at task scheduler or schedule task using command prompt ?


Solution

  • I just need to use mysql -h host -u user < batch-file

    And store every command in batch-file.