Manual:renameDbPrefix.php
MediaWiki version: | ≥ 1.13 |
MediaWiki file: renameDbPrefix.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.42.3 • 1.41.4 • 1.39.10 |
Classes: | RenameDbPrefix |
Details
editrenameDbPrefix.php file is a maintenance script to change the prefix of database tables.
Run this script after changing $wgDBprefix on a wiki. The wiki will have to get downtime to do this correctly.
Arguments
editOption | Description | Required |
---|---|---|
--old | Old db prefix; 0 for none | Required |
--new | New db prefix; 0 for none | Required |
Usage
editphp maintenance/renameDbPrefix.php --old oldDBprefix --new newDBprefix
Terminal
$ php maintenance/renameDbPrefix.php --old "hiwiki_" --new "enwiki_" Renaming DB prefix for tables of wiki from 'hiwiki_' to 'enwiki_' Renaming table hiwiki_actor to enwiki_actor Renaming table hiwiki_archive to enwiki_archive Renaming table hiwiki_bot_passwords to enwiki_bot_passwords Renaming table hiwiki_category to enwiki_category Renaming table hiwiki_categorylinks to enwiki_categorylinks Renaming table hiwiki_change_tag to enwiki_change_tag Renaming table hiwiki_change_tag_def to enwiki_change_tag_def Renaming table hiwiki_comment to enwiki_comment Renaming table hiwiki_content to enwiki_content Renaming table hiwiki_content_models to enwiki_content_models Renaming table hiwiki_externallinks to enwiki_externallinks Renaming table hiwiki_filearchive to enwiki_filearchive Renaming table hiwiki_image to enwiki_image Renaming table hiwiki_imagelinks to enwiki_imagelinks Renaming table hiwiki_interwiki to enwiki_interwiki Renaming table hiwiki_ip_changes to enwiki_ip_changes Renaming table hiwiki_ipblocks to enwiki_ipblocks Renaming table hiwiki_ipblocks_restrictions to enwiki_ipblocks_restrictions Renaming table hiwiki_iwlinks to enwiki_iwlinks Renaming table hiwiki_job to enwiki_job Renaming table hiwiki_l10n_cache to enwiki_l10n_cache Renaming table hiwiki_langlinks to enwiki_langlinks Renaming table hiwiki_log_search to enwiki_log_search Renaming table hiwiki_logging to enwiki_logging Renaming table hiwiki_module_deps to enwiki_module_deps Renaming table hiwiki_objectcache to enwiki_objectcache Renaming table hiwiki_oldimage to enwiki_oldimage Renaming table hiwiki_page to enwiki_page Renaming table hiwiki_page_props to enwiki_page_props Renaming table hiwiki_page_restrictions to enwiki_page_restrictions Renaming table hiwiki_pagelinks to enwiki_pagelinks Renaming table hiwiki_protected_titles to enwiki_protected_titles Renaming table hiwiki_querycache to enwiki_querycache Renaming table hiwiki_querycache_info to enwiki_querycache_info Renaming table hiwiki_querycachetwo to enwiki_querycachetwo Renaming table hiwiki_recentchanges to enwiki_recentchanges Renaming table hiwiki_redirect to enwiki_redirect Renaming table hiwiki_revision to enwiki_revision Renaming table hiwiki_revision_actor_temp to enwiki_revision_actor_temp Renaming table hiwiki_revision_comment_temp to enwiki_revision_comment_temp Renaming table hiwiki_searchindex to enwiki_searchindex Renaming table hiwiki_site_identifiers to enwiki_site_identifiers Renaming table hiwiki_site_stats to enwiki_site_stats Renaming table hiwiki_sites to enwiki_sites Renaming table hiwiki_slot_roles to enwiki_slot_roles Renaming table hiwiki_slots to enwiki_slots Renaming table hiwiki_templatelinks to enwiki_templatelinks Renaming table hiwiki_text to enwiki_text Renaming table hiwiki_updatelog to enwiki_updatelog Renaming table hiwiki_uploadstash to enwiki_uploadstash Renaming table hiwiki_user to enwiki_user Renaming table hiwiki_user_former_groups to enwiki_user_former_groups Renaming table hiwiki_user_groups to enwiki_user_groups Renaming table hiwiki_user_newtalk to enwiki_user_newtalk Renaming table hiwiki_user_properties to enwiki_user_properties Renaming table hiwiki_watchlist to enwiki_watchlist Renaming table hiwiki_watchlist_expiry to enwiki_watchlist_expiry Done! [57 tables]
Common error
edit- Invalid prefix!
This error occurs when either the --old or --new value is incorrect.