Auto import of the csv file

[expired user #11570]'s profile image [expired user #11570] posted 6 years ago in General Permalink

i have a csv file in my local pc which updates every five minutes but i have to import it manually everytime which i dont want.Is there any possiblity so that i can give the path to that file and heidisql imports automatically or any script i need to write down.

ansgar's profile image ansgar posted 6 years ago Permalink

You cannot do much scheduled stuff with HeidiSQL, as it's a GUI. You should definitely use mysql(.exe) on the command line to do that. Here's an example on how the command line could look like:

mysql -hlocalhost -uroot --execute"LOAD DATA INFILE 'data.csv' INTO TABLE db2.my_table;"

Such command lines can be scheduled by your Windows task planner for example.

[expired user #11570]'s profile image [expired user #11570] posted 6 years ago Permalink

i dont have mysql.exe in mysql utilities.Could you please elaborate more about the above statement.I have read your previous posts about mysql utilities, i tried this command line as attached.The problem is i am getting the data in the heidisql but the data is not overwritten.I have used this command --drop-first but no use,Normally in heidisql when i import the csv file manually i have to select the "truncate destination table before import".Is there a way to overcome the problem.please help me out i want to schedule the task anyhow.

2 attachment(s):
  • Sql_cmd
  • Heidisql

Please login to leave a reply, or register at first.