Skip to content

Instantly share code, notes, and snippets.

@chuckreynolds
Created February 28, 2013 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuckreynolds/5055512 to your computer and use it in GitHub Desktop.
Save chuckreynolds/5055512 to your computer and use it in GitHub Desktop.
Change Table Prefix's on WordPress Database Most client sites I redo have the default "wp_" table prefix and I like to change that to something random like "wp_fE4se_" (or whatever) for security reasons. 1) run the RENAME table on each and every table in your wordpress database to rename the table itself 2) Run the next two lines and change NEWP…
RENAME table wp_commentmeta TO wp_NEWPREFIX_commentmeta;
RENAME table wp_comments TO wp_NEWPREFIX_comments;
RENAME table wp_links TO wp_NEWPREFIX_links;
RENAME table wp_options TO wp_NEWPREFIX_options;
RENAME table wp_postmeta TO wp_NEWPREFIX_postmeta;
RENAME table wp_posts TO wp_NEWPREFIX_posts;
RENAME table wp_terms TO wp_NEWPREFIX_terms;
RENAME table wp_term_relationships TO wp_NEWPREFIX_term_relationships;
RENAME table wp_term_taxonomy TO wp_NEWPREFIX_term_taxonomy;
RENAME table wp_usermeta TO wp_NEWPREFIX_usermeta;
RENAME table wp_users TO wp_NEWPREFIX_users;
UPDATE wp_NEWPREFIX_usermeta SET meta_key = REPLACE( `meta_key` , 'wp_', 'wp_NEWPREFIX_' );
UPDATE wp_NEWPREFIX_options SET option_name = wp_NEWPREFIX_user_roles WHERE option_name = wp_user_roles AND blog_id = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment