Heres a couple things I constantly forget. Im including them here so Ill have them for future reference.
How to “Scan and Replace” a String in MYSQL
( Note the AS400-ish phrasing of that title).
Big Note: Be really mindful of serialized information !!!!
( I actually utilized the code above to “transfer” a lot of image referencess from a WordPress set up in a folder as much as the root domain).
How to Search for a String in an Entire MYSQL Database.
After doing “scans and changes” it might be necessary to inspect your work. Heres the technique.
Log into PHPMYADMIN and highlight (select) the entire database. Click search. You will see a screen something like this:.
Thanks to http://www.mydigitallife.info/how-to-find-and-replace-text-in-mysql-database-using-sql/ for these little pieces of code.
update wp_posts set post_content = replace( post_content, http://domain.com/blog/, http://domain.com/).
Log into PHPMYADMIN and emphasize (choose) the entire database. Click search. You will see a screen something like this:.
The syntax of REPLACE is REPLACE( text_string, from_string, to_string).
You should put in your SQL-syntax wildcard and choose the tables to browse. Click Go, and youll see:.
update TABLE_NAME set FIELD_NAME = replace( FIELD_NAME, find this string, replace found string with this string);.
The above statement will change all circumstances of http://domain.com/blog to http://domain.com/ in the field of post_content of wp_posts table.