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.
1 thought on “Change WordPress database table name prefix”
Comments are closed.