Search-and-Replace
One of the main reasons it is difficult to migrate a site by just copy-and-pasting a database is that the database contains serialized arrays.
For example, if you need to replace all instances of http://testsite.com with http://livewebsite.com your serialized arrays will be incorrect because the string count won’t match up if you do a simple copy-and-paste or use an SQL statement to make the replacement.
The WP-CLI search-replace command unserializes arrays first, performs the search and replace, then re-serializes the arrays. You can get this done with a simple command:
wp search-replace oldstring newstring
Additional parameters allow you to do a lot more, including preview what will be replaced by using –dry-run.
Transients
WordPress keeps temporary site data (transients) in the database. Expired transients can build up with some plugins–like Woocommerce–installed.
The wp transient command is used to manage transients.
You can delete expired transients with the following command:
wp transient delete --expired