Remove backticks from MySQL dumps

I found myself in a peculiar situation last week. I'd been asked to downgrade a server from MySQL 4.1 to MySQL 3.23. Believe me, I tried to advise against the request, but I didn't succeed.

I made a MySQL 3.23 compatible dump with --compatible=mysql323, but the dump came out with backticks around the database names. This works with some 3.23 versions, but it doesn't work with others. Apparently RHEL 3's MySQL 3.23 is one of those versions where it simply won't work.

This sed line came in handy to strip the backticks from the USE lines in the dump:

sed -e "s/^USE \`\(.*\)\`/USE \1/g"

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Printed from: http://rackerhacker.com/2008/06/18/remove-backticks-from-mysql-dumps/ .
© Major Hayden 2010.

Leave a Reply