Rename WP DB Prefix

Wanted to change wp database prefix on a couple of sites following importing data with WP Migrate DB Pro.

First delete the initial tables:

DROP TABLE `amcom_commentmeta`;                 
DROP TABLE `amcom_comments`;                 
DROP TABLE `amcom_links`;
DROP TABLE `amcom_options`;
DROP TABLE `amcom_postmeta`;
DROP TABLE `amcom_posts`;
DROP TABLE `amcom_term_relationships`;
DROP TABLE `amcom_term_taxonomy`;
DROP TABLE `amcom_termmeta`;
DROP TABLE `amcom_terms`;
DROP TABLE `amcom_usermeta`;
DROP TABLE `amcom_users`;

Then rename the imported ones

RENAME TABLE `wp_commentmeta` TO `amcom_commentmeta`;                    
RENAME TABLE `wp_comments` TO `amcom_comments`;                       
RENAME TABLE `wp_links` TO `amcom_links`;                          
RENAME TABLE `wp_options` TO `amcom_options`;                        
RENAME TABLE `wp_postmeta` TO `amcom_postmeta`;                       
RENAME TABLE `wp_posts` TO `amcom_posts`;                          
RENAME TABLE `wp_term_relationships` TO `amcom_term_relationships`;             
RENAME TABLE `wp_term_taxonomy` TO `amcom_term_taxonomy`;                  
RENAME TABLE `wp_termmeta` TO `amcom_termmeta`;                       
RENAME TABLE `wp_terms` TO `amcom_terms`;                          
RENAME TABLE `wp_usermeta` TO `amcom_usermeta`;                       
RENAME TABLE `wp_users` TO `amcom_users`;            

Now update entries in user_options table:

UPDATE amcom_options SET option_name = REPLACE(option_name, 'wp_', 'amcom_') WHERE option_name LIKE 'wp_%';

Lastly update entries in user_meta table:

UPDATE amcom_usermeta SET meta_key = REPLACE(meta_key,'wp_', 'amcom_') WHERE meta_key LIKE 'wp_%';