The db export feature is quite useful, but when moving wordpress from one domain to another, one needs to search the db for instances of the site url and replace it with the new site URL. This is a complex and time consuming task. Furthermore, many plugins and themes, store the site URL within serialized data. Thus, doing a simple find and replace breaks the serialized string, as serialized data stores both the representation of the text and metadata about the size of the string in bytes.
A popular tool has been created to deal with this problem here: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
An awesome feature for WP-CLI would be to extend the wp db export command to export a version of the database with a find and replace (including within serialized data) this would save many people many headaches.
WP-CLI is a great tool. Many thanks to all who contribute.
An awesome feature for WP-CLI would be to extend the wp db export command to export a version of the database with a find and replace (including within serialized data) this would save many people many headaches.
Use wp search-replace --export=<filename> (doc), introduced in v0.22.0, to create a SQL export with replaced strings.
Most helpful comment
Use
wp search-replace --export=<filename>(doc), introduced in v0.22.0, to create a SQL export with replaced strings.