How to Change WordPress Database Prefix

From this tutorial you’ll learn how to change WordPress database prefix using file manager. The task is necessary to accomplish if you don’t see any changes on your website after importing the database.

Changing WordPress Database Prefix
  1. First, you need to access your preferable file manager. You can use either FTP client or your hosting service cPanel file manager. In this tutorial we’ll use hosting server cPanel file manager.
  2. You have to locate wp-config.php file in the WordPress root folder. Click on Edit to open it.
  3. Let’s check your current table prefix. It looks as in the example provided below.
    If you have a default table prefix in wp-config.php file, you needn’t change it. Proceed to the step where adding website’s link is described.
  4. Now you need to open the SQL file with any code editor that is convenient for you. The file is in the theme/manual_install folder.
  5. Hit Ctrl+F hotkeys and input in the search field wp_ prefix to find all the instances where it is used. You should replace them with your own table prefix (from wp-config.php file).
  6. Then search for your custom prefixes with the underscore before them (e.g. _wp). You have to change them back to _wp. You need to accomplish this step because some of the instances where _wp value does not refer to the table prefixes (like _wp_attached_file).
  7. Now let’s add the website link. Hit Ctrl+F hotkeys and input your_website_url_here text in the search field. You need to replace it with your actual website URL link (e. g., http://mysite.com). Beware to use “/” slash symbol at the end of the link.
  8. Save the changes. Now you can import the SQL file.

Was this helpful?