Site Overlay

Change WordPress database table name prefix

A good security tip when installing your WordPress site is to change the database table prefix, the idea is that this will hide the tables from any hackers looking to compromise your site. This can be done in the wp-config.php file and the variable $table_prefix. Changing this value from the default wp_ to, for example, stdb_ will change the table wp_posts to stdb_posts, making it more difficult for hackers to find it. Using stdb_ is only an example, you should treat the prefix like a password, include letters and numbers to make it more difficult to find.

If you have already installed the wordpress site and now you want to change the prefix then use the following steps:
1. backup your wordpress database to a sql file (you can use phpmyadmin)
2. open that *.sql file (make another copy first) using text editor, then find and replace all “wp_” prefix to “something_”.
3. now, drop all tables of your wordpress databases (don’t drop the database)
4. import the *.sql file which has been edited before into your wordpress databases.
5. and lastly, edit your wp-config.php file and change the $table_prefix = ‘wp_’; to $table_prefix = ’something_’;
6. you may find that your plugins are deactivated automatically when this happens, so you’ll want to activate them again if that’s the case… I’d recommend deactivating them prior to doing this anyway as a precaution.

Published By:

Author: sakinshrestha

Hello. My name is Sakin Shrestha, and I am a technology entrepreneur from Nepal. I am passionate about helping this sector grow, for many reasons. The technology sector creates jobs for many young Nepalis who would otherwise migrate to foreign countries. It lets Nepali professionals develop skills for a fast-changing global workplace, and compete at a high level with anyone, anywhere in the world. If it grows, it will provide a viable career option for many young Nepalis, and help us reap the benefits of a global economy.

1 thought on “Change WordPress database table name prefix

  1. Pingback: divani-mebel fabrika

Comments are closed.