As documented under LIKE
:
Note
Because MySQL uses C escape syntax in strings (for example, “
\n
” to represent a newline character), you must double any “\
” that you use inLIKE
strings. For example, to search for “\n
”, specify it as “\\n
”. To search for “\
”, specify it as “\\\\
”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against.
\\%
is parsed as a string containing a literal backslash followed by a percentage character, which is then interpreted as a pattern containing only a literal percentage sign.