SQL 47
SQL replace WordPress table prefix By micha on 3rd June 2024 03:46:45 PM
  1. 1. OPEN your DATABASE IN PhpMyAdmin.
  2. 2. Click ON the DATABASE name IN the menu TO the LEFT TO unfold ALL TABLES.
  3. 3. SELECT ALL TABLES that START WITH wp_; you should have 12 IN total.
  4. 4. Click WITH selected TO OPEN the drop-down menu AND SELECT REPLACE TABLE prefix.
  5. 5. TYPE IN wp_ IN the From-FIELD, AND the NEW name IN the To-FIELD, IN this example, david_.
  6. 6. Click Continue TO make the CHANGE.
  7.  
  8. # Run SQL
  9. UPDATE NEWPREFIX_usermeta SET meta_key = 'NEWPREFIX_capabilities' WHERE meta_key = 'OLDPREFIX_capabilities';
  10. UPDATE NEWPREFIX_usermeta SET meta_key = 'NEWPREFIX_user_level' WHERE meta_key = 'OLDPREFIX_user_level';
  11. UPDATE NEWPREFIX_usermeta SET meta_key = 'NEWPREFIX_autosave_draft_ids' WHERE meta_key = 'OLDPREFIX_autosave_draft_ids';
  12. UPDATE NEWPREFIX_options SET option_name = 'NEWPREFIX_user_roles' WHERE option_name = 'OLDPREFIX_user_roles';

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.