'Importing data from CSV file into MYSQL
I am trying to load data into a database table (MYSQL 8.0.28) in my Windows 11 pc 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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VAIBHAV VERMA |