
There may be a time after you have completed your setup that you realize you need to change the default WordPress database ‘table_prefix’ for your WordPress database (from the default ‘wp_’ or cryptic random string provided by Installatron) to something more specific or specialized.
In any case, there is no need to worry, it’s a simple three step process if you do it manually; or you can use a plugin (but this is definitely not my preference).
Step 1: Change the database table prefix in wp-config file
- Login to your hosting provider and access the file manager (methods to accomplish this vary depending your host and their tools)
- Navigate to the ‘public_html’ folder, locate the ‘wp-config.php’ file and edit the file
- Locate the following: $table_prefix = “wp_”;
- Replace ‘wp_’ with the prefix of your choice (i.e. ‘cpwd_’)
- Save the updated wp-config.php
Step 2: Change database table prefix in MySQL/MariaDB
- Open your database in phpMyAdmin.
- Click on the database name in the menu to the left to unfold all tables.
- Select all tables that start with wp_; there should be 12 in total (if no additional plugins are installed).
- Click “With selected” to open the drop-down menu and select “Replace table prefix”.

- Type in wp_ in the From-field, and the new name in the To-field (Keeping with our use case, I will use cpwd_).
- Click Continue to make the change
Step 3: Replace all references to old database table prefix
- Click on the SQL tab in the menu at the top of the screen.
- Copy and paste in the following commands:
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_capabilities' where meta_key = 'OLDPREFIX_capabilities';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_user_level' where meta_key = 'OLDPREFIX_user_level';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_autosave_draft_ids' where meta_key = 'OLDPREFIX_autosave_draft_ids';
update NEWPREFIX_options set option_name = 'NEWPREFIX_user_roles' where option_name = 'OLDPREFIX_user_roles';
- Replace OLDPREFIX and NEWPREFIX, with your own old and new prefix. In keeping with our example, we are going to replace the default wp_ with cpwd_:
update cpwd_usermeta set meta_key = 'cpwd_capabilities' where meta_key = 'wp_capabilities';
update cpwd_usermeta set meta_key = 'cpwd_user_level' where meta_key = 'wp_user_level';
update cpwd_usermeta set meta_key = 'cpwd_autosave_draft_ids' where meta_key = 'wp_autosave_draft_ids';
update cpwd_options set option_name = 'cpwd_user_roles' where option_name = 'wp_user_roles';
- Click on Go to run the commands and complete the change.
And that’s it, you have successfully changed your WordPress database table prefix!