Skip to content

Remplacer le préfixe de vos tables MySQL dans WordPress

Étape 1 : renommer les tables

RENAME table `wp_commentmeta` TO `cbti__trzqdqsmo_commentmeta`;
RENAME table `wp_comments` TO `NEWPREFIX_comments`;
RENAME table `wp_links` TO `NEWPREFIX_links`;
RENAME table `wp_options` TO `NEWPREFIX_options`;
RENAME table `wp_postmeta` TO `NEWPREFIX_postmeta`;
RENAME table `wp_posts` TO `NEWPREFIX_posts`;
RENAME table `wp_terms` TO `NEWPREFIX_terms`;
RENAME table `wp_termmeta` TO `NEWPREFIX_termmeta`;
RENAME table `wp_term_relationships` TO `NEWPREFIX_term_relationships`;
RENAME table `wp_term_taxonomy` TO `NEWPREFIX_term_taxonomy`;
RENAME table `wp_usermeta` TO `NEWPREFIX_usermeta`;
RENAME table `wp_users` TO `NEWPREFIX_users`;

Étape 2 : modifier à la main les valeurs dans la table « options »

SELECT * FROM NEWPREFIX_options WHERE option_name LIKE ‘%OLDPREFIX_%’

Étape 3: mettre à jour les privilèges des utilisateurs

update NEWPREFIX_usermeta set meta_key = ‘NEWPREFIX_capabilities’ where meta_key = ‘OLDPREFIX_capabilities’;
update NEWPREFIX_usermeta set meta_key = ‘NEWPREFIX_user_level’ where meta_key = ‘OLDPREFIX_user_level’;
update NEWPREFIX_usermeta set meta_key = ‘NEWPREFIX_autosave_draft_ids’ where meta_key = ‘OLDPREFIX_autosave_draft_ids’;
update NEWPREFIX_options set option_name = ‘NEWPREFIX_user_roles’ where option_name = ‘OLDPREFIX_user_roles’;

Sources

Published inBackendDéveloppementGestionWordpress

Be First to Comment

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *