Categories

Featured templates

WordPress. 如何改变数据库表前缀(如有必要)和导入SQL文件

Amina Freinger December 30, 2014
Rating: 5.0/5. From 3 votes.
Please wait...

本教程将向您展示如何进行更改 database table prefix (如有需要)及进口 SQL file.

WordPress. 如何改变数据库表前缀(如有必要)和导入SQL文件

检查和更改数据库表前缀

If you import the SQL file to your database 你的 website,你应该检查一下 database table prefix 用于WordPress安装. 您可以在WordPress配置文件中找到它. 请执行以下步骤:

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

  2. 通过任何代码打开该文件 editor 核对一下您的桌号. 它将出现在文件中,如所示 screenshot:

    wordpress_how_to_change_database_table_prefix_in_sql_file1

    $table_prefix = 'tm_';
    

    注意:如果你的WordPress database table prefix 是默认的(wp_),您不应该在 SQL file. 你需要跳到第六步——添加站点链接.

  3. Open the SQL file with any code editor,例如notepad++. 这个文件叫做themeXXXXX.sql (其中XXXXX是主题的编号),可以位于“sources文件夹(以防你有常规的。 WordPress template)或“theme/manual_install”文件夹(如果您有 Cherry Framework WordPress模板)的模板包.

  4. 在搜索面板的帮助下(CTRL + F热键)替换ALL wp_ 使用自己的表前缀(tm_ prefix in our case). Click Replace All button:

    wordpress_how_to_change_database_table_prefix_in_sql_file2

  5. Then replace All _tm (你的表前缀前面有下划线)返回默认的WordPress前缀 _wp (前面有下划线). Click Replace All button:

    wordpress_how_to_change_database_table_prefix_in_sql_file3

    你应该执行这些更改,因为 SQL 文件包含许多不引用表前缀的值,例如 "_wp_attached_file". To make sample data 在您的站点上运行良好,您的表前缀更改不应该影响该值.

  6. 最后一件事是网站链接添加. Use the search function (CTRL + F热键)找到 your_website_url_here 文本并将其替换为您的网站URL(例如, http://yoursite.. Com(链接末尾没有斜杠"/"). 请务必点击 Replace All button and save it:

    wordpress_how_to_change_database_table_prefix_in_sql_file4

  7. 将更改保存在文件中.

SQL file importing

IMPORTANT: SQL file importing to your database will overwrite 您现有的内容和 website settings. Do not import the SQL 如果您想保留网站上现有的内容,请使用.

  1. Open phpMyAdmin 面板,以便导入修改 themeXXXXX.sql file to WordPress database.

  2. 在右列中,您可以看到可用数据库的列表. Click the name of the database 你在安装WordPress引擎时使用的:

    wordpress_how_to_change_database_table_prefix_in_sql_file5

  3. 现在你应该看到你的 database 控件顶部菜单上方的名称 phpMyAdmin panel. Open Import tab:

    wordpress_how_to_change_database_table_prefix_in_sql_file6

  4. Then click Browse 按钮并选择已编辑的 SQL file. 选择完文件后,单击 GO 页面底部的按钮:

    wordpress_how_to_change_database_table_prefix_in_sql_file7

  5. 你会看到一条信息 "导入已成功完成,XXX查询已执行".

Now refresh your site. 它应该看起来和工作的演示.

注:如果你还有 layout 问题,只需登录WordPress管理面板,打开 Cherry Options tab,向下滚动页面并单击 Save Options button. 然后再次刷新您的网站.

本教程到此结束. 现在你知道如何改变了 database table prefix and import SQL file.

请随时查看下面的详细视频教程:

WordPress. 如何改变数据库表前缀(如有必要)和导入SQL文件

最酷的Wordpress主题
这个条目被张贴了出来 WordPress Tutorials and tagged change, data, import, prefix, sample, SQL, WordPress. Bookmark the permalink.

Submit a ticket

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: Submit a ticket