Rename Tables in MySQL

If you want to hand code renaming tables, here’s the sample.

Single Table

RENAME TABLE wp_users TO kwg_users;

multiple tables

RENAME TABLE wp_users TO kwtg_users,
wp_usermeta TO kwtg_usermeta,
wp_site TO kwtg_wpsite,
wp_signups TO kwtg_signups;

This is handy when renaming a whole lot of tables as in the case of WordPress mu where each blog has its own set of tables. If you decide to rename them for security reasons (like you forgot to change the default table prefix during installation), it will be a pain to change them one by one through phpMyAdmin.

Incoming search terms:

  • mysql rename table recursively
  • rename multiple tables mysql
  • rename table in mysql
  • rinomina wp-posts in my sql

Modified WP Table Prefix in bbPress

If you change your WordPress/WordPress mu table prefix (and thus, renamed the tables too) and you have a bbPress integrated with it, chances are your bbPress will lose its connection with WordPress since the configuration is not in bb-config.php. You’ll need to update the meta tables, too through mysql or phpmyadmin. Here’s the update query.


UPDATE bb_meta
SET meta_value = 'wpmu_'
WHERE meta_key = 'wp_table_prefix';

That’s of course considering your bbPress table is bb_meta and the new prefix for WordPress/WordPress mu is wpmu.