How to use the LOAD DATA INFILE statement when the file is in a different location?

I want to use the LOAD DATA INFILE statement to import data into a table.

If the file is available on the same system, it works beautifully and is successfully imported, but when the file is on another system, it cannot find the path.

Can someone explain how to use the LOAD DATA INFILE statement to import data into a MySQL table from another system or remotely?

+6
source share
1 answer

When you execute LOAD DATA INFILE , the file must be located on the system running the MySQL database in the data path.

If the file is on your system, add the LOCAL keyword. Then the file will be sent to the server, saved in a temporary directory and launched from there. This only works if the necessary permissions are set .

 LOAD DATA LOCAL INFILE '/path/to/your/local/file' INTO TABLE yourtable 
+10
source

Source: https://habr.com/ru/post/900497/


All Articles