{"id":21376,"date":"2014-12-30T06:32:57","date_gmt":"2014-12-30T11:32:57","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=21376"},"modified":"2016-02-24T04:15:46","modified_gmt":"2016-02-24T09:15:46","slug":"wordpress-how-to-change-database-tables-prefix-in-sql-file","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-how-to-change-database-tables-prefix-in-sql-file.html","title":{"rendered":"WordPress. How to change database tables prefix (if necessary) and import SQL file"},"content":{"rendered":"<p>\r\n<\/p>\r\n<p>This tutorial is going to show you how to change database table prefix (if necessary) and import SQL file.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=0qGh6XCZd4w?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change database tables prefix (if necessary) and import SQL file<\/a><\/p>\r\n<h3 class=\"custom\">Checking and changing database table prefix<\/h3>\r\n<p>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:<\/p>\r\n<ol>\r\n<li>\r\n<p>Connect your FTP or open the File Manager to find <strong>wp-config.php<\/strong> file in the root folder of the WordPress installation.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Open this file via any code editor and check your table prefix. It will appear in the file like shown on the screenshot:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file11.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file11-300x136.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file1\" width=\"300\" height=\"136\" class=\"aligncenter size-medium wp-image-40014\" \/><\/a><\/p>\r\n<pre class=\"brush:php\">\r\n$table_prefix  = 'tm_';\r\n<\/pre>\r\n<p class=\"attention\">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 &#8211; the site link adding.<\/p>\r\n<\/li>\r\n<li>\r\n<p>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 &quot;sources&quot; folder (in case you have regular WordPress template) or &quot;theme\/manual_install&quot; folder (in case you have Cherry Framework WordPress template) of your template package. <\/p>\r\n<\/li>\r\n<li>\r\n<p>With the help of the search panel (CTRL + F hotkey) replace ALL <strong>wp_<\/strong> instances with your own table prefix (<strong>tm_<\/strong> prefix in our case). Click <strong>Replace All<\/strong> button:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file21.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file21-300x168.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file2\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40015\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Then replace All <strong>_tm<\/strong> (your table prefix with the underscore before it) back with the default WordPress prefix <strong>_wp<\/strong> (with the underscore before it). Click <strong>Replace All<\/strong> button: <\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/11\/wordpress_how_to_change_database_table_prefix_in_sql_file31.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/11\/wordpress_how_to_change_database_table_prefix_in_sql_file31.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file3\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40016\" \/><\/a><\/p>\r\n<p>You should perform that changes, because SQL file contains many values that do not refer to the table prefix, like <strong>&quot;_wp_attached_file&quot;<\/strong>. To make sample data work well on your site, your table prefix changes should not affect that values. <\/p>\r\n<\/li>\r\n<li>\r\n<p>The last thing is the site link adding. Use the search function (CTRL + F hotkey) to find the <strong>your_website_url_here<\/strong> text and replace it with your site URL (for example, http:\/\/yoursite.com without slash &quot;\/&quot; in the end of the link). Please make sure to click <strong>Replace All<\/strong> button and save it: <\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file41.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file41-300x168.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file4\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40017\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Save changes in the file.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<h3 class=\"custom\">SQL file importing <\/h3>\r\n<p class=\"warning\">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.<\/p>\r\n<ol>\r\n<li>\r\n<p>Open phpMyAdmin panel in order to import modified <strong>themeXXXXX.sql<\/strong> file to WordPress database.<\/p>\r\n<\/li>\r\n<li>\r\n<p>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:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file51.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file51-300x168.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file5\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40018\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Now you should see your database name above the top menu of the phpMyAdmin panel. Open <strong>Import<\/strong> tab:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file61.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file61-300x168.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file6\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40019\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Then click <strong>Browse<\/strong> button and select the edited SQL file. When you are done selecting the file, click <strong>GO<\/strong> button at the bottom of the page:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file7.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/03\/wordpress_how_to_change_database_table_prefix_in_sql_file7-300x168.jpg\" alt=\"wordpress_how_to_change_database_table_prefix_in_sql_file7\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-40020\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p> You will see a message saying <strong>&quot;Import has been successfully finished, XXX queries executed&quot;<\/strong>.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>Now refresh your site. It should look and work as the demo.<\/p>\r\n<p class=\"attention\">NOTE: If you still have any layout issue on your site, just log in the WordPress admin panel, open <strong>Cherry Options<\/strong> tab, scroll the page down and click <strong>Save Options<\/strong> button. Then refresh your site again.<\/p>\r\n<p>This is the end of the tutorial. Now you know how to change database table prefix and import SQL file.<\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=0qGh6XCZd4w?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to change database tables prefix (if necessary) and import SQL file<\/a><\/p>\r\n<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to change database tables prefix (if necessary) and import SQL file.<\/p>\n","protected":false},"author":53,"featured_media":21382,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[1183,647,706,1095,646,581,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/21376"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=21376"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/21376\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/21382"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=21376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=21376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=21376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}