[英]MySQL database-dump import
I need some details on importing and exporting a MySQL 8 database.我需要一些有关导入和导出 MySQL 8 数据库的详细信息。
If the entire database is backed up in one dump, is it possible to restore a single table, or should the individual tables be exported?如果整个数据库都备份在一个转储中,是否可以恢复单个表,还是应该导出单个表?
When setting FOREIGN_KEY_CHECKS
, UNIQUE_CHECKS
, and AUTOCOMMIT
to 0
, is this done to the database that you are importing to from MySQL?将FOREIGN_KEY_CHECKS
、 UNIQUE_CHECKS
和AUTOCOMMIT
设置为0
时,是否对要从 MySQL 导入的数据库执行此操作? If so, it seems to have no effect for me.如果是这样,它似乎对我没有影响。 If not, please provide the details on how to do these settings.如果没有,请提供有关如何进行这些设置的详细信息。
Should the settings in 2.) be done to the database prior to exporting in order to get faster importing?是否应该在导出之前对数据库进行 2.) 中的设置以加快导入速度?
This 12 hour import of one table with 5M records and several indexes is for the birds.一张包含 5M 记录和多个索引的表的 12 小时导入是针对鸟类的。
CREATE TABLE
and INSERT INTO
ones that you wish to skip.由于转储是一个大文本文件,几乎只包含 SQL 命令,您还可以删除其中的部分内容,尤其是您希望跳过的CREATE TABLE
和INSERT INTO
部分。 Exporting only portions of a database has the same effect.仅导出数据库的一部分具有相同的效果。 Sometimes you don't have the choice (either no text editor available dealing with large files, or no source database to export available).有时您别无选择(要么没有可用于处理大文件的文本编辑器,要么没有可导出的源数据库)。 What you haven't stated is how you import and with which program: via console and the "mysql" client (ie mysql < data.sql
)?您没有说明的是您如何导入以及使用哪个程序:通过控制台和“mysql”客户端(即mysql < data.sql
)? Have you checked the operating system's performance during the import to see a bottleneck (ie high disk usage, much swapping, no more RAM left, CPU usage...)?您是否在导入过程中检查过操作系统的性能以发现瓶颈(即磁盘使用率高、交换量大、内存不足、CPU 使用率...)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.