How to change the url in a WordPress database using wp-cli

First always do a BACKUP

Then using WP-CLI it’s possible to preview the changes of the website address with this command line adding at the end –dry-run

wp search-replace '' 'http://mysite.dev2' --dry-run

Then if the result is ok it’s possible to launch the command without –dry-run

wp search-replace '' 'http://mysite.dev2'