Rename table prefix on existing WordPress site

Follow these few steps to rename the table prefix of your existing WordPress site.

Edit wp-config.php and change

$table_prefix = 'wp_';

to any other prefix, try to make it abstract and hard to be guessed by anyone, for example:

$table_prefix = 'v5r33w67ee_';

Rename the tables in your database, these are the SQL queries to rename the core tables:

RENAME table `wp_users` TO `v5r33w67ee_users`;
RENAME table `wp_usermeta` TO `v5r33w67ee_usermeta`;
RENAME table `wp_comments` TO `v5r33w67ee_comments`;
RENAME table `wp_commentmeta` TO `v5r33w67ee_commentmeta`;
RENAME table `wp_links` TO `v5r33w67ee_links`;
RENAME table `wp_options` TO `v5r33w67ee_options`;
RENAME table `wp_posts` TO `v5r33w67ee_posts`;
RENAME table `wp_postmeta` TO `v5r33w67ee_postmeta`;
RENAME table `wp_terms` TO `v5r33w67ee_terms`;
RENAME table `wp_term_taxonomy` TO `v5r33w67ee_term_taxonomy`;
RENAME table `wp_term_relationships` TO `v5r33w67ee_term_relationships`;

Add the queries to rename any other existing table that have been created from other plugins or themes.
You can also rename the tables in phpMyAdmin, by clicking on the operations tab

Update the references to the old table prefix in the usermeta and options table running these SQL queries.

UPDATE `v5r33w67ee_usermeta` SET `meta_key` = REPLACE( `meta_key`, 'wp_', 'v5r33w67ee_' );
UPDATE `v5r33w67ee_options` SET `option_name` = 'v5r33w67ee_user_roles' WHERE `option_name` = 'wp_user_roles';