{"id":482,"date":"2015-03-09T17:32:36","date_gmt":"2015-03-09T16:32:36","guid":{"rendered":"https:\/\/www.nullalo.com\/?p=482"},"modified":"2025-10-22T10:20:28","modified_gmt":"2025-10-22T08:20:28","slug":"wordpress-come-cambiare-il-prefisso-delle-tabelle","status":"publish","type":"post","link":"https:\/\/www.nullalo.com\/en\/wordpress-how-to-change-tables-prefix\/","title":{"rendered":"WordPress: how to change tables prefix"},"content":{"rendered":"<p><\/p>\n<p style=\"text-align: justify;\">In a basic WordPress installation, database tables prefix is &#8220;<strong>wp_<\/strong>&#8220;.<\/p>\n<p style=\"text-align: justify;\">First of all, let&#8217;s try to understand why should this prefix be changed, instead of leaving the default one: because of the impressive number of WordPress websites, and of the huge amount of information stored in those databases,\u00a0spammers and\u00a0hackers continuosly execute automated codes for\u00a0<strong>SQL injection<\/strong>, so they can gain access to website information.<\/p>\n<p style=\"text-align: justify;\">Since those automated scripts are triggered on the default prefix, a good starting point is to change it, so to avoid to be in the potential victims of such attacks.<\/p>\n<p style=\"text-align: justify;\">If the prefix is changed during first installation, we&#8217;re already set and done: if not, to change tables prefix (i.e. from wp_ to\u00a0xy_12345_) of an already populated database, we need to follow this procedure, after\u00a0executing a\u00a0<strong>database backup<\/strong>\u00a0just in case of problems:<\/p>\n<ol style=\"text-align: justify;\">\n<li style=\"text-align: justify;\">change the prefix in\u00a0<strong>wp-config.php<\/strong> file:\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">$table_prefix = 'xy_12345_';<\/pre>\n<\/li>\n<li style=\"text-align: justify;\"><strong>rename<\/strong>\u00a0all database tables via SQL:\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">RENAME table `wp_commentmeta` TO `xy_12345_commentmeta`;\r\nRENAME table `wp_comments` TO `xy_12345_comments`;\r\nRENAME table `wp_links` TO `xy_12345_links`;\r\nRENAME table `wp_options` TO `xy_12345_options`;\r\nRENAME table `wp_postmeta` TO `xy_12345_postmeta`;\r\nRENAME table `wp_posts` TO `xy_12345_posts`;\r\nRENAME table `wp_terms` TO `xy_12345_terms`;\r\nRENAME table `wp_term_relationships` TO `xy_12345_term_relationships`;\r\nRENAME table `wp_term_taxonomy` TO `xy_12345_term_taxonomy`;\r\nRENAME table `wp_usermeta` TO `xy_12345_usermeta`;\r\nRENAME table `wp_users` TO `xy_12345_users`;<\/pre>\n<\/li>\n<li style=\"text-align: justify;\">manually change all references in\u00a0<strong>options<\/strong> table, selecting them with this query:\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">SELECT * FROM `xy_12345_options` WHERE `option_name` LIKE '%wp_%'<\/pre>\n<\/li>\n<li style=\"text-align: justify;\">manually change all references in\u00a0<strong>usermeta<\/strong>\u00a0table, selecting them with this query:\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">SELECT * FROM `xy_12345_usermeta` WHERE `meta_key` LIKE '%wp_%'<\/pre>\n<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">At this point, after verifying that everything works, you can make a backup of the new database and your job is done!<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>In a basic WordPress installation, database tables prefix is &#8220;wp_&#8220;. First of all, let&#8217;s try to understand why should this prefix be changed, instead of leaving the default one: because of the impressive number of WordPress websites, and of the huge amount of information stored in those databases,\u00a0spammers and\u00a0hackers continuosly<\/p>\n","protected":false},"author":2,"featured_media":458,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6,33],"tags":[38,34,39],"class_list":["post-482","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","category-wordpress","tag-prefisso","tag-wordpress","tag-tabelle"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WordPress: how to change tables prefix - Nullalo!<\/title>\n<meta name=\"description\" content=\"In un&#039;installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 &quot;wp_&quot;. Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.nullalo.com\/?p=482\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress: how to change tables prefix - Nullalo!\" \/>\n<meta property=\"og:description\" content=\"In un&#039;installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 &quot;wp_&quot;. Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.nullalo.com\/?p=482\" \/>\n<meta property=\"og:site_name\" content=\"Nullalo!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/nullalo\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/fulvio.sicurezza\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-09T16:32:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-22T08:20:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1140\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fulvio Sicurezza\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/FulvioSicurezza\" \/>\n<meta name=\"twitter:site\" content=\"@Nullalo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fulvio Sicurezza\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.nullalo.com\/?p=482\",\"url\":\"https:\/\/www.nullalo.com\/?p=482\",\"name\":\"[:it]WordPress: come cambiare il prefisso delle tabelle[:en]WordPress: how to change tables prefix[:] - Nullalo!\",\"isPartOf\":{\"@id\":\"https:\/\/www.nullalo.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=482#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=482#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg\",\"datePublished\":\"2015-03-09T16:32:36+00:00\",\"dateModified\":\"2025-10-22T08:20:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c\"},\"description\":\"In un'installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 \\\"wp_\\\". Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,\",\"breadcrumb\":{\"@id\":\"https:\/\/www.nullalo.com\/?p=482#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.nullalo.com\/?p=482\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nullalo.com\/?p=482#primaryimage\",\"url\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg\",\"contentUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg\",\"width\":1140,\"height\":600},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.nullalo.com\/?p=482#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.nullalo.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress: come cambiare il prefisso delle tabelle\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.nullalo.com\/#website\",\"url\":\"https:\/\/www.nullalo.com\/\",\"name\":\"Nullalo!\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.nullalo.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c\",\"name\":\"Fulvio Sicurezza\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nullalo.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg\",\"contentUrl\":\"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg\",\"caption\":\"Fulvio Sicurezza\"},\"sameAs\":[\"http:\/\/www.generalservice.na.it\",\"https:\/\/www.facebook.com\/fulvio.sicurezza\",\"http:\/\/it.linkedin.com\/in\/fulviosicurezza\",\"https:\/\/x.com\/https:\/\/twitter.com\/FulvioSicurezza\",\"https:\/\/www.youtube.com\/c\/FulvioSicurezzaIT\"],\"url\":\"https:\/\/www.nullalo.com\/en\/author\/f-sicurezza\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress: how to change tables prefix - Nullalo!","description":"In un'installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 \"wp_\". Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.nullalo.com\/?p=482","og_locale":"en_US","og_type":"article","og_title":"WordPress: how to change tables prefix - Nullalo!","og_description":"In un'installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 \"wp_\". Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,","og_url":"https:\/\/www.nullalo.com\/?p=482","og_site_name":"Nullalo!","article_publisher":"https:\/\/www.facebook.com\/nullalo","article_author":"https:\/\/www.facebook.com\/fulvio.sicurezza","article_published_time":"2015-03-09T16:32:36+00:00","article_modified_time":"2025-10-22T08:20:28+00:00","og_image":[{"width":1140,"height":600,"url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg","type":"image\/jpeg"}],"author":"Fulvio Sicurezza","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/FulvioSicurezza","twitter_site":"@Nullalo","twitter_misc":{"Written by":"Fulvio Sicurezza","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.nullalo.com\/?p=482","url":"https:\/\/www.nullalo.com\/?p=482","name":"[:it]WordPress: come cambiare il prefisso delle tabelle[:en]WordPress: how to change tables prefix[:] - Nullalo!","isPartOf":{"@id":"https:\/\/www.nullalo.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.nullalo.com\/?p=482#primaryimage"},"image":{"@id":"https:\/\/www.nullalo.com\/?p=482#primaryimage"},"thumbnailUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg","datePublished":"2015-03-09T16:32:36+00:00","dateModified":"2025-10-22T08:20:28+00:00","author":{"@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c"},"description":"In un'installazione di base di WordPress, il prefisso delle tabelle del database \u00e8 \"wp_\". Capiamo innanzitutto perch\u00e9 dovremmo cambiare questo prefisso,","breadcrumb":{"@id":"https:\/\/www.nullalo.com\/?p=482#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.nullalo.com\/?p=482"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nullalo.com\/?p=482#primaryimage","url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg","contentUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/03\/wordpress.jpg","width":1140,"height":600},{"@type":"BreadcrumbList","@id":"https:\/\/www.nullalo.com\/?p=482#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.nullalo.com\/"},{"@type":"ListItem","position":2,"name":"WordPress: come cambiare il prefisso delle tabelle"}]},{"@type":"WebSite","@id":"https:\/\/www.nullalo.com\/#website","url":"https:\/\/www.nullalo.com\/","name":"Nullalo!","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.nullalo.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/fe9c2885376a6ab076e06461ae1b546c","name":"Fulvio Sicurezza","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nullalo.com\/#\/schema\/person\/image\/","url":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg","contentUrl":"https:\/\/www.nullalo.com\/wp-content\/uploads\/2015\/02\/Fulvio-Sicurezza_avatar_1424711147-96x96.jpg","caption":"Fulvio Sicurezza"},"sameAs":["http:\/\/www.generalservice.na.it","https:\/\/www.facebook.com\/fulvio.sicurezza","http:\/\/it.linkedin.com\/in\/fulviosicurezza","https:\/\/x.com\/https:\/\/twitter.com\/FulvioSicurezza","https:\/\/www.youtube.com\/c\/FulvioSicurezzaIT"],"url":"https:\/\/www.nullalo.com\/en\/author\/f-sicurezza\/"}]}},"_links":{"self":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/comments?post=482"}],"version-history":[{"count":1,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/482\/revisions"}],"predecessor-version":[{"id":1970,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/posts\/482\/revisions\/1970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/media\/458"}],"wp:attachment":[{"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/media?parent=482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/categories?post=482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nullalo.com\/en\/wp-json\/wp\/v2\/tags?post=482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}