mysqldump not escaping single quotes properly
That output of mysqldump is working as designed, and it is properly escaped, unless you try to restore the dump on a MySQL instance with SQL_MODE=NO_BACKSLASH_ESCAPES set.

There's an outstanding feature request to make mysqldump use a pair of single-quotes to escape literal single-quotes, as per ANSI SQL.  See http://bugs.mysql.com/bug.php?id=65941

In the meantime you might be able to convert from backslash-singlequote to pair-of-singlequotes with a command line this:

mysqldump test | sed -e "s/\\\'/''/g" &gt; test-dump.sql


I tried that out briefly by creating a dummy table in my test database and inserting the string "O'Hare" into the table.  But that's hardly a comprehensive test -- I take no responsibility for this suggestion working in all cases.