[wp-trac] [WordPress Trac] #34189: Add warning about changing $table_prefix for existing database
WordPress Trac
noreply at wordpress.org
Wed Oct 7 10:50:08 UTC 2015
#34189: Add warning about changing $table_prefix for existing database
--------------------------------+-----------------------------
Reporter: bjerke-johannessen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
When changing the $table_prefix for an existing database, it is not
sufficient to rename the tables. You also have to change several values in
at least two tables. In my case, changing prefix from "wp_" to "bbj_wp_"
this involved at least the following SQL:
UPDATE bbj_wp_options
SET option_name = 'bbj_wp_user_roles'
WHERE option_name = 'wp_user_roles';
UPDATE bbj_wp_usermeta
SET meta_key = 'bbj_wp_user_level'
WHERE meta_key = 'wp_user_level';
UPDATE bbj_wp_usermeta
SET meta_key = 'bbj_wp_capabilities'
WHERE meta_key = 'wp_capabilities';
The attached patch adds a warning to the generated wp-config.php file
about this. There is much room for improvement here, including giving
detailed information on what needs to be changed or even re-writingthe
particular misfeature that stores tables names in other tables. The patch
is intended as a stop-gap 'til such improvements are made. Hopefully this
will prevent others from chasing down the same wildly unexpected behavior
should they decide to change $table_prefix
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34189>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list