How to Change Database Prefixes and Import SQL file

Sometimes when you’ve imported a SQL dump to your WordPress database, nothing changes. In this case, you might need to change the database prefix.

From this tutorial you’ll learn how to change database prefix, and how to import SQL file to the database.

Changing Database Prefix
  1. Navigate to your hosting server’s file manager and find wp-config.php file in the WordPress root directory.
  2. Open the file and search for your table prefix. It may look like:
    $table_prefix = ‘tm_’;
  3. Now you can copy this table prefix from the file (in our case it is ‘tm_’).
  4. Open your extracted template package on your hard drive.
  5. In the theme/manual install folder open the .sql file using any text editor which is convenient for you (Sublime, Notepad, etc.).
  6. Hit Ctrl+F hotkeys to open the search panel, and switch to Replace tab.
  7. Now you need to replace all wp_ standard prefixes with the prefix you have copied (‘tm_’).
  8. Click on Replace All button to replace all the instances.
  9. You need to replace the instances, where _tm is used, with your previous _wp . It is necessary to preserve wp instances in the cases where wp is not actually a database prefix.
  10. Click on Replace All button again.
  11. Now you can replace your_website_url_here instances with your actual website’s URL, without slash sign in the end. You can find it in your browser’s address bar.
  12. You’ll need to import the edited .sql file to your database.
  13. Open phpMyAdmin tool and find the database you’ve used when installing WordPress, in the right column.
  14. Now open Import tab and browse the .sql file with the changes. Click on Go button to start import.
  15. When everything is done, you’ll see the information notice Import has been successfully finished.
  16. Now you need to refresh your website. It will look like the demo.

Was this helpful?