- Web templates
- E-commerce Templates
- Loaded Commerce
- E-Commerce Comparison
- E-commerce Comparison: Payment and Shipping methods
- E-commerce templates compatibility table
- CMS & Blog Templates
- CMS Comparison
- CMS templates versions compatibility
- Facebook Templates
- Website Builders
WordPress. How to change database tables prefix (if necessary) and import SQL file
December 30, 2014
This tutorial is going to show you how to change database table 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:
Connect your FTP or open the File Manager to find wp-config.php file in the root folder of the WordPress installation.
Open this file via any code editor and check your table prefix. It will appear in the file like shown on the screenshot:
$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.
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.
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:
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:
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.
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:
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.
Open phpMyAdmin panel in order to import modified themeXXXXX.sql file to WordPress database.
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:
Now you should see your database name above the top menu of the phpMyAdmin panel. Open Import tab:
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:
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: