We know that WordPress database table, you can set the prefix, the default is WP_, many students also default on the Wp_, if some reason (such as increased security) to modify the prefix of the WordPress data, what should we do?
Before you start
Modifying the data is a high-risk job, the beginning must be a good database backup , you can also set the blog to maintain state .
Modifying database prefixes in wp-config.php
Open your wp-config.php file and change the database prefix wp_ to the prefix you want, such as WPJAM_.
$table _prefix = ' WPJAM_ ';
Modify data table name
Open Phpmysql, locate your database, and execute the following SQL, changing all database table prefixes from wp_ to WPJAM_.
RENAME table ' Wp_commentmeta ' to ' Wpjam_commentmeta ';
RENAME table ' wp_comments ' to ' wpjam_comments ';
RENAME table ' wp_links ' to ' wpjam_links ';
RENAME table ' wp_options ' to ' wpjam_options ';
RENAME table ' Wp_postmeta ' to ' Wpjam_postmeta ';
RENAME table ' wp_posts ' to ' wpjam_posts ';
RENAME table ' wp_terms ' to ' wpjam_terms ';
RENAME table ' wp_term_relationships ' to ' wpjam_term_relationships ';
RENAME table ' wp_term_taxonomy ' to ' wpjam_term_taxonomy ';
RENAME table ' Wp_usermeta ' to ' Wpjam_usermeta ';
RENAME table ' wp_users ' to ' wpjam_users ';
Modify the data in the Options table
Use the following statement to change the option_name in the options table to the beginning of the WP_ with the value beginning with the WPJAM_.
SELECT REPLACE (option_name, ' wp_ ', ' wpjam_ ') from Wpjam_options;
Modify the data in the Usermeta table
Use the following statement to change the Meta_key in the Usermeta table to the beginning of the WPJAM_ with the value of WP_.
SELECT REPLACE (Meta_key, ' wp_ ', ' wpjam_ ') from Wpjam_usermeta;
It's done!