Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can somebody please help me understand what is ESCAPED BY clause means in LOAD DATA LOCAL INFILE statement MySQL 5.5. I am a newbie to MySQL so please bear with me.

share|improve this question
up vote 1 down vote accepted

Generally the defaults cause LOAD DATA INFILE to act as follows when reading input:

Look for line boundaries at newlines.
Break lines into fields at tabs.
Do not expect fields to be enclosed within any quoting characters.
Interpret occurrences of tab, newline, or \' preceded by\' as literal characters that are part of field values.
Conversely, the defaults cause SELECT ... INTO OUTFILE to act as follows when writing output:

Write tabs between fields.
Do not enclose fields within any quoting characters.

Use \' to escape instances of tab, newline or\' that occur within field values.

Write newlines at the ends of lines.

Note that to write FIELDS ESCAPED BY '\\', you must specify two backslashes for the value to be read as a single backslash.

For Further Details Please Have a Look at following Link :-

share|improve this answer

For input, if the FIELDS ESCAPED BY character is not empty, occurrences of that character are stripped and the following character is taken literally as part of a field value. Some two-character sequences that are exceptions, where the first character is the escape character. These sequences are shown in the following table (using “\” for the escape character). The rules for NULL handling are described later in this section. Character Escape Sequence

\0 An ASCII NUL (0x00) character

\b A backspace character

\n A newline (linefeed) character

\r A carriage return character

\t A tab character.

\Z ASCII 26 (Control+Z)


“String Literals”.

If the FIELDS ESCAPED BY character is empty, escape-sequence interpretation does not occur

.For output, if the FIELDS ESCAPED BY character is not empty, it is used to prefix the following characters on output:


If FIELDS ESCAPED BY is empty, a field value that contains an occurrence of FIELDS ENCLOSED BY or LINES TERMINATED BY followed by the FIELDS TERMINATED BY value causes LOAD DATA INFILE to stop reading a field or line too early. This happens because LOAD DATA INFILE cannot properly determine where the field or line value ends.

Basically Escaped by is used to escape the column on the basis of charachters appearing in data if it's not required

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.