Home > Software engineering >  Importing data from CSV file into MYSQL
Importing data from CSV file into MYSQL

Time:04-12

I am trying to load data into a database table (MYSQL 8.0.28) in my windows 11 machine through "load data local infile" command. I have gone through the syntax (https://dev.mysql.com/doc/refman/8.0/en/load-data.html), some problems with trying to import string as date, enabling the import process in the server with the server variable "local_infile" and the connection variable "OPT_LOCAL_INFILE".

Now when I try to run the script I get:

Error Code: 2. File 'covidDeath.csv' not found (OS errno 2 - No such file or directory)

I want to use relative addresses, and I have copied the file into the directory of the server executable but it is the same. Where should I put the data files in order to reference them with a relative address?

CodePudding user response:

If both files are in same folder then try using the following command:

load data local infile './covidDeath.csv'

Let me know if you still face any issue.

  • Related