简体   繁体   中英

Differences between DATA INFILE and LOAD DATA LOCAL INFILE

LOAD DATA INFILE和LOAD DATA LOCAL INFILE有什么区别?

From the MySQL documentation :

If LOCAL is specified, the file is read by the client program on the client host and sent to the server.

If LOCAL is not specified, the file must be located on the server host and is read directly by the server.

If you include the LOCAL keyword, MySQL will look for the file to load locally, and if you omit LOCAL then it will attempt to find it on the server.

LOAD DATA INFILE gets the file from the database server's local filesystem. The file has to be located in the database directory or have world read permissions, and the client username must have the FILE privilege.

LOAD DATA LOCAL INFILE reads the file on the client, and sends the contents to the server.

You can find more details in the documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM