balteo
balteo

Reputation: 24659

Specifying the escape character inserted by mysqldump in sql files

I would like to be able to control and specify the escape character used by mysqldump for data exports.

Instead of a \ I would like to use a double backslash \\ or ''

Apart from --fields-escaped-by=char which seems to be used for tab delimited exports, I was not able to find any relevant option.

Can anyone please help?

Upvotes: 4

Views: 3085

Answers (1)

Sean Redmond
Sean Redmond

Reputation: 4114

I just ran into this same problem. There is an open bug on this in MySQL's bug tracker (which is amazing because it's such a basic thing). My quick fix was to pipe mysqldump through sed:

[your mysqldump command] | sed "s/\\\'/''/g" > dumpfile.sql

Upvotes: 4

Related Questions