content_image/727129.jpg
## Input File Character Set 

The file name must be given as a literal string. On Windows, specify backslashes in path names as forward slashes or doubled backslashes. The server interprets the file name using the character set indicated by the character_set_filesystem  system variable. 

By default, the server interprets the file contents using the character set indicated by the character_set_database  system variable. If the file contents use a character set different from this default, it is a good idea to specify that character set by using the CHARACTER SET  clause. A character set of binary  specifies “no conversion.” 

SET NAMES  and the setting of character_set_client  do not affect interpretation of file contents. 

LOAD DATA  interprets all fields in the file as having the same character set, regardless of the data types of the columns into which field values are loaded. For proper interpretation of the file, you must ensure that it was written with the correct character set. For example, if you write a data file with mysqldump -T  or by issuing a SELECT ... INTO OUTFILE  statement in mysql , be sure to use a --default-character- set  option to write output in the character set to be used when the file is loaded with LOAD DATA . 

## Input File Location 

<img src='content_image/727129.jpg'>

These rules determine the LOAD DATA  input file location: 

## Note 

It is not possible to load data files that use the ucs2 , utf16 , utf16le , or utf32 character set. 

•If LOCAL  is not specified, the file must be located on the server host. The server reads the file directly, locating it as follows: 

•If the file name is an absolute path name, the server uses it as given. 

•If the file name is a relative path name with leading components, the server looks for the file relative to its data directory. 

•If the file name has no leading components, the server looks for the file in the database directory of the default database. 

•If LOCAL  is specified, the file must be located on the client host. The client program reads the file, locating it as follows: 

•If the file name is an absolute path name, the client program uses it as given. 

•If the file name is a relative path name, the client program looks for the file relative to its invocation directory. 

When LOCAL  is used, the client program reads the file and sends its contents to the server. The server creates a copy of the file in the directory where it stores temporary files. See Section B.3.3.5, “Where MySQL Stores Temporary Files” . Lack of sufficient space for the copy in this directory can cause the LOAD DATA LOCAL  statement to fail. 

The non- LOCAL  rules mean that the server reads a file named as ./myfile.txt  relative to its data directory, whereas it reads a file named as myfile.txt  from the database directory of the default database. For example, if the following LOAD DATA  statement is executed while db1  is the default database, the server reads the file data.txt  from the database directory for db1 , even though the statement explicitly loads the file into a table in the db2  database: 

