I wanted to update the database prefix one this site, but most of the tutorials out there have you do it manually. There are some plugins available, but I didn’t trust most of them, and the ones that I did were kind of bloated with other features, and I didn’t want to mess with the cleanup, etc.
So, I wrote a WP-CLI command to do it instead.
Install: wp package install iandunn/wp-cli-rename-db-prefix
Use: wp rename-db-prefix new_prefix_
Hello Ian,
Just like to thank you for creating that package. I did install it yesterday and it worked wonderfully, thank you for your work on this.
Regards
Hi,
Thank you for this. However I’ve run the install but I get Error: ‘rename-db-prefix’ is not a registered wp command. See ‘wp help’. when trying to run the command after install.
Thanks
Hi Ian,
Actually from trying the install again it seems to stop at ‘Updating dependencies’. I’m not sure why.
Thanks
Yes, it looks like your package is broken
Error: ‘rename-db-prefix’ is not a registered wp command. See ‘wp help’. when trying to run the command after install.
Hello, I downloaded the package right now to try it with Local by flywheel. It worked wonders. Thanks!
Wow. Worked like a charm.
It’s still works in WordPress 5.1.1 as of April 2019.
Nice! But do you plan on doing multisite support? It shouldn’t be that hard to implement I estimate
Ian, thank you so much, you saved me a lot of time. I knew that some smart person had figured a way to rename the wp tables in batch. This is still working on 2022, wp 6.0.1
Best regards!