Blog

WEBFI-WordPress-How to Change the WordPress Database Prefix to Improve Security



Your WordPress database is the control center for your entire site because all of your information is stored there. Some people may try to hack your site if they know the database name. In this video, we will show you how to change the WordPress database prefix to improve your site’s security.

If you liked this video, then please Like and consider subscribing to our channel for more WordPress videos.

Text version of this tutorial:
http://www.wpbeginner.com/wp-tutorials/how-to-change-the-wordpress-database-prefix-to-improve-security/

Follow us on Twitter:
http://twitter.com/wpbeginner

Checkout our website for more WordPress Tutorials
http://www.wpbeginner.com/

Summary of this Tutorial:

Start by making a backup of your database.

Then go to your root directory and fid wp-config.php

Look for the table prefix and change it to something different

Now go to phpmyadmin and change the table names

Either click each table or copy the code below to update all of your tables.

RENAME table `wp_commentmeta` TO `wp_a123456_commentmeta`;
RENAME table `wp_comments` TO `wp_a123456_comments`;
RENAME table `wp_links` TO `wp_a123456_links`;
RENAME table `wp_options` TO `wp_a123456_options`;
RENAME table `wp_postmeta` TO `wp_a123456_postmeta`;
RENAME table `wp_posts` TO `wp_a123456_posts`;
RENAME table `wp_terms` TO `wp_a123456_terms`;
RENAME table `wp_term_relationships` TO `wp_a123456_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_a123456_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_a123456_usermeta`;
RENAME table `wp_users` TO `wp_a123456_users`;

You may need to edit tables created by any plugins.

Next query the option table and select everything with a name starting with wp_ using the query below.

SELECT * FROM `wp_a123456_options` WHERE `option_name` LIKE ‘%wp_%’

As well for the usermeta table with a meta_key using wp_ using the query below and change to your new prefix

SELECT * FROM `wp_a123456_usermeta` WHERE `meta_key` LIKE ‘%wp_%’

Related Links:

How to do a database backup

http://www.wpbeginner.com/beginners-guide/how-to-make-a-wordpress-database-backup-manually/

source

15 Comments

  • Ama Davies on October 8, 2014

    Way too fast!

  • Gary Harding on October 21, 2014

    This is called WP Beginner? This is not a beginning tutorial. I appreciate what you're doing and all the other videos, though!!  This topic is too complicated for 1:46 video, I think. 

  • Gary Harding on October 21, 2014

    Can't you bypass this whole step by setting up the original WordPress installation and choose your table name then? 

  • Scott Ritchie on November 30, 2014

    This is a fantastic tutorial. Tells you the exact steps with visuals. You have now been bookmarked. 

  • Rajib Kumar Paul on February 11, 2015

    Hackers can attacks your sure anytime. Seeing your video one can easily change his / her database prfix so that hackers can't make a easy search on database. 

  • D Taylor on September 27, 2015

    Do we have to leave the "wp_" prefix at the beginning or can we remove this altogether?

  • Ken Low on December 20, 2015

    would you recommend to use plugin to do the job?

  • Peter Gašperan on August 26, 2016

    Actually there is a function in phpmyadmin (under the Structure tab, below the tables..) to replace your table prefixes….

  • Peter Gašperan on August 26, 2016

    Hmm.. the options table…. I only have one with wp_ prefix (wp_user_roles), the other ones are "wpuxss…" and "WPLANG"…. do I change those too?

  • Peter Gašperan on August 26, 2016

    Should i also change the UserMeta table called "dismissed_wp_pointer"…?

  • Keith Agnew on February 15, 2017

    Wow, that was fast .. I got dizzy. I'm fine with the table updates – had to watch it 2-3 times .. but the 2nd part, updating via the %wp_% – you didn't show us how to update the results. no clue what to do here, and you didn't update one result for us to follow.. Clearly a video for Devs to Devs .. just sayin' #peace

  • NerdPiece on May 8, 2017

    Great video, to anyone who cant follow her well: http://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-database-management-with-phpmyadmin/ DON'T FORGET TO BACKUP (Yes I know this link is already posted)

  • yashwanth vijay on November 18, 2017

    I get a error stating "#1044 – Access denied for user ' to database 'information_schema" . May i know hoe to resolve this

  • Ayush Chaudhary on May 1, 2018

    too fast, so slow and steady 😉

  • Cesar Aneudis Rodriguez Feliz on December 18, 2018

    Unable to understand. The way she presents the info is for advanced users.

WhatsApp us
Live Chat

Office hours operation Mon-Sun 8:00 am ET – 4:00 pm ET

To start your Premium WP or Cpanel service, use our domain search engine, if the domain you want is available, contact us by Whats app to activate your project.

The easiest, fastest, and most secure way to communicate with us.
loading
Please enter your domain.
Please verify that you are not a robot.

Terms Privacy

 

 

error: WEBFINET SECURITY IS ON