This is not ANSI standard SQL. \n is C style escaping, and not
supported by ANSI SQL. It is supported by MySQL when ANSI SQL mode is
disabled.
The preferred solution is to use a prepared statement:
update mytable set myfield=? where id=?;
Another solution is to use:
update mytable set myfield='first line
second line' where id=1;
Regards,
Thomas