WordPress Tutorials

How to change default database tables prefix in WordPress

How to change default database tables prefix in WordPress

The standard WordPress install uses wp_ as a prefix for all tables in the database. By simply changing this prefix to something else, you will make your site a lot less vulnerable to hackers who attempt SQL injections and assume that you are using the generic wp_ prefix. On a brand new WordPress install, you will have the option to use any table prefix you want; you should change the default wp_ prefix to something custom.

If you would like to do this on a WordPress site that is already up and running, you can follow these steps:

  1. Make a database backup just in case you mess this up! It`s very important!
  2. Open wp-config.php and change $table_prefix = ‘wp_’; to $table_prefix = ‘anyprefixyoulike_’;
  3. Update the existing table names in your database to include your new prefix with the following SQL commands using phpMyAdmin or any SQL client such as MySQL Workbench:

Warning! You will have to run a similar rename SQL query for any custom tables added by your app or plugins you are using.

Using SQL commands or a SQL client update any instance of wp_ in the prefix_options and anyprefixyoulike_usermeta tables and change any values like wp_ to prefix_ :

Test out your site and make sure everything is working as it should.

If you don’t feel comfortable manually making these changes, there are some plugins that can change your table prefix for you:

Article written by dudecmsadmin


Hi there! I`m admin of community where I share everything from web. Im interested more in webdesign.

Leave a Reply

Your email address will not be published. Required fields are marked *

Regular Labs(NoNumber) Extensions are ready for download!
Download Now