If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WordPress. How to change database tables prefix (if necessary) and import SQL file

This tutorial is going to show you how to change database table prefix (if necessary) and import SQL file.

WordPress. How to change database tables prefix (if necessary) and import SQL file

Checking and changing database table prefix

If you import the SQL file to your database and nothing happens on your website, you should check the database table prefix used for your WordPress installation. You may find it in the WordPress configuration file. Please, perform the following steps:

  1. Connect your FTP or open the File Manager to find wp-config.php file in the root folder of the WordPress installation.

  2. Open this file via any code editor and check your table prefix. It will appear in the file like shown on the screenshot:

    wordpress_how_to_change_database_table_prefix_in_sql_file1

    $table_prefix  = 'tm_';
    

    NOTE: if your WordPress database table prefix is default (wp_), you should not change it in the SQL file. You need to skip to the sixth step – the site link adding.

  3. Open the SQL file with any code editor, for example, Notepad++. This file is called themeXXXXX.sql (where XXXXX is the number of your theme) and may be located in "sources" folder (in case you have regular WordPress template) or "theme/manual_install" folder (in case you have Cherry Framework WordPress template) of your template package.

  4. With the help of the search panel (CTRL + F hotkey) replace ALL wp_ instances with your own table prefix (tm_ prefix in our case). Click Replace All button:

    wordpress_how_to_change_database_table_prefix_in_sql_file2

  5. Then replace All _tm (your table prefix with the underscore before it) back with the default WordPress prefix _wp (with the underscore before it). Click Replace All button:

    wordpress_how_to_change_database_table_prefix_in_sql_file3

    You should perform that changes, because SQL file contains many values that do not refer to the table prefix, like "_wp_attached_file". To make sample data work well on your site, your table prefix changes should not affect that values.

  6. The last thing is the site link adding. Use the search function (CTRL + F hotkey) to find the your_website_url_here text and replace it with your site URL (for example, http://yoursite.com without slash "/" in the end of the link). Please make sure to click Replace All button and save it:

    wordpress_how_to_change_database_table_prefix_in_sql_file4

  7. Save changes in the file.

SQL file importing

IMPORTANT: SQL file importing to your database will overwrite your existing content and website settings. Do not import the SQL file if you want to keep the existing content on your site.

  1. Open phpMyAdmin panel in order to import modified themeXXXXX.sql file to WordPress database.

  2. In the right column you can see the list of available databases. Click the name of the database you used during the WordPress engine installation:

    wordpress_how_to_change_database_table_prefix_in_sql_file5

  3. Now you should see your database name above the top menu of the phpMyAdmin panel. Open Import tab:

    wordpress_how_to_change_database_table_prefix_in_sql_file6

  4. Then click Browse button and select the edited SQL file. When you are done selecting the file, click GO button at the bottom of the page:

    wordpress_how_to_change_database_table_prefix_in_sql_file7

  5. You will see a message saying "Import has been successfully finished, XXX queries executed".

Now refresh your site. It should look and work as the demo.

NOTE: If you still have any layout issue on your site, just log in the WordPress admin panel, open Cherry Options tab, scroll the page down and click Save Options button. Then refresh your site again.

This is the end of the tutorial. Now you know how to change database table prefix and import SQL file.

Feel free to check the detailed video tutorial below:

WordPress. How to change database tables prefix (if necessary) and import SQL file