Script by https://wpindexfixer.tools.managedwphosting.nl

These are the queries for WP version 5.4.2

You need to replace 5f33f8bc6adcc_ with your site prefix. This could be wp_ or something else. @see https://wordpress.org/support/article/editing-wp-config-php/#table_prefix where to find your own prefix.

-- Starting with 5f33f8bc6adcc_users
DELETE FROM 5f33f8bc6adcc_users WHERE ID = 0;
ALTER TABLE 5f33f8bc6adcc_users ADD PRIMARY KEY  (ID);
ALTER TABLE 5f33f8bc6adcc_users ADD KEY user_login_key (user_login);
ALTER TABLE 5f33f8bc6adcc_users ADD KEY user_nicename (user_nicename);
ALTER TABLE 5f33f8bc6adcc_users ADD KEY user_email (user_email);
ALTER TABLE 5f33f8bc6adcc_users MODIFY ID bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_usermeta
DELETE FROM 5f33f8bc6adcc_usermeta WHERE umeta_id = 0;
ALTER TABLE 5f33f8bc6adcc_usermeta ADD PRIMARY KEY  (umeta_id);
ALTER TABLE 5f33f8bc6adcc_usermeta ADD KEY user_id (user_id);
ALTER TABLE 5f33f8bc6adcc_usermeta ADD KEY meta_key (meta_key(191));
ALTER TABLE 5f33f8bc6adcc_usermeta MODIFY umeta_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_posts
DELETE FROM 5f33f8bc6adcc_posts WHERE ID = 0;
ALTER TABLE 5f33f8bc6adcc_posts ADD PRIMARY KEY  (ID);
ALTER TABLE 5f33f8bc6adcc_posts ADD KEY post_name (post_name(191));
ALTER TABLE 5f33f8bc6adcc_posts ADD KEY type_status_date (post_type,post_status,post_date,ID);
ALTER TABLE 5f33f8bc6adcc_posts ADD KEY post_parent (post_parent);
ALTER TABLE 5f33f8bc6adcc_posts ADD KEY post_author (post_author);
ALTER TABLE 5f33f8bc6adcc_posts MODIFY ID bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_comments
DELETE FROM 5f33f8bc6adcc_comments WHERE comment_ID = 0;
ALTER TABLE 5f33f8bc6adcc_comments ADD PRIMARY KEY  (comment_ID);
ALTER TABLE 5f33f8bc6adcc_comments ADD KEY comment_post_ID (comment_post_ID);
ALTER TABLE 5f33f8bc6adcc_comments ADD KEY comment_approved_date_gmt (comment_approved,comment_date_gmt);
ALTER TABLE 5f33f8bc6adcc_comments ADD KEY comment_date_gmt (comment_date_gmt);
ALTER TABLE 5f33f8bc6adcc_comments ADD KEY comment_parent (comment_parent);
ALTER TABLE 5f33f8bc6adcc_comments ADD KEY comment_author_email (comment_author_email(10));
ALTER TABLE 5f33f8bc6adcc_comments MODIFY comment_ID bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_links
DELETE FROM 5f33f8bc6adcc_links WHERE link_id = 0;
ALTER TABLE 5f33f8bc6adcc_links ADD PRIMARY KEY  (link_id);
ALTER TABLE 5f33f8bc6adcc_links ADD KEY link_visible (link_visible);
ALTER TABLE 5f33f8bc6adcc_links MODIFY link_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_options
DELETE FROM 5f33f8bc6adcc_options WHERE option_id = 0;
ALTER TABLE 5f33f8bc6adcc_options ADD PRIMARY KEY  (option_id);
ALTER TABLE 5f33f8bc6adcc_options ADD UNIQUE KEY option_name (option_name);
ALTER TABLE 5f33f8bc6adcc_options ADD KEY autoload (autoload);
ALTER TABLE 5f33f8bc6adcc_options MODIFY option_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_postmeta
DELETE FROM 5f33f8bc6adcc_postmeta WHERE meta_id = 0;
ALTER TABLE 5f33f8bc6adcc_postmeta ADD PRIMARY KEY  (meta_id);
ALTER TABLE 5f33f8bc6adcc_postmeta ADD KEY post_id (post_id);
ALTER TABLE 5f33f8bc6adcc_postmeta ADD KEY meta_key (meta_key(191));
ALTER TABLE 5f33f8bc6adcc_postmeta MODIFY meta_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_terms
DELETE FROM 5f33f8bc6adcc_terms WHERE term_id = 0;
ALTER TABLE 5f33f8bc6adcc_terms ADD PRIMARY KEY  (term_id);
ALTER TABLE 5f33f8bc6adcc_terms ADD KEY slug (slug(191));
ALTER TABLE 5f33f8bc6adcc_terms ADD KEY name (name(191));
ALTER TABLE 5f33f8bc6adcc_terms MODIFY term_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_term_taxonomy
DELETE FROM 5f33f8bc6adcc_term_taxonomy WHERE term_taxonomy_id = 0;
ALTER TABLE 5f33f8bc6adcc_term_taxonomy ADD PRIMARY KEY  (term_taxonomy_id);
ALTER TABLE 5f33f8bc6adcc_term_taxonomy ADD UNIQUE KEY term_id_taxonomy (term_id,taxonomy);
ALTER TABLE 5f33f8bc6adcc_term_taxonomy ADD KEY taxonomy (taxonomy);
ALTER TABLE 5f33f8bc6adcc_term_taxonomy MODIFY term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_term_relationships
DELETE FROM 5f33f8bc6adcc_term_relationships WHERE object_id = 0;
DELETE FROM 5f33f8bc6adcc_term_relationships WHERE term_taxonomy_id = 0;
ALTER TABLE 5f33f8bc6adcc_term_relationships ADD PRIMARY KEY  (object_id,term_taxonomy_id);
ALTER TABLE 5f33f8bc6adcc_term_relationships ADD KEY term_taxonomy_id (term_taxonomy_id);
-- Starting with 5f33f8bc6adcc_termmeta
DELETE FROM 5f33f8bc6adcc_termmeta WHERE meta_id = 0;
ALTER TABLE 5f33f8bc6adcc_termmeta ADD PRIMARY KEY  (meta_id);
ALTER TABLE 5f33f8bc6adcc_termmeta ADD KEY term_id (term_id);
ALTER TABLE 5f33f8bc6adcc_termmeta ADD KEY meta_key (meta_key(191));
ALTER TABLE 5f33f8bc6adcc_termmeta MODIFY meta_id bigint(20) unsigned NOT NULL auto_increment;
-- Starting with 5f33f8bc6adcc_commentmeta
DELETE FROM 5f33f8bc6adcc_commentmeta WHERE meta_id = 0;
ALTER TABLE 5f33f8bc6adcc_commentmeta ADD PRIMARY KEY  (meta_id);
ALTER TABLE 5f33f8bc6adcc_commentmeta ADD KEY comment_id (comment_id);
ALTER TABLE 5f33f8bc6adcc_commentmeta ADD KEY meta_key (meta_key(191));
ALTER TABLE 5f33f8bc6adcc_commentmeta MODIFY meta_id bigint(20) unsigned NOT NULL auto_increment;


Script by https://wpindexfixer.tools.managedwphosting.nl