Find Replace in MySQL

Feb 11, 2009 by     No Comments    Posted under: Databases, Tech

Somewhere between the backing-up and restoration of my MySQL WordPress database I picked up some strange characters. Rather than having to go through by hand to edit them out, I used a nice SQL snippet to do a full-database search and replace.

update [table_name] set [field_name] =
replace([field_name],'[string_to_find]','[string_to_replace]');

So in my case, to get rid of these weird “” characters, I ran the statement

update wp_posts set post_content = replace(post_content,'ÂÂ','');

Worked perfectly for me, it should for you as well.

Got anything to say? Go ahead and leave a comment!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">