1

我有一个250 MB的备份SQL文件,但新主机的限制只有100 MB ...

有没有一个程序可以让你将一个 SQL 文件拆分成多个 SQL 文件?

4

3 回答 3

1

您可以在 Eclipse 中拆分一个大文件。我在 Windows 中成功尝试了一个 105GB 的文件:

只需将MySQLDumpSplitter库添加到您的项目中: http ://dl.bintray.com/verace/MySQLDumpSplitter/jar/

关于如何导入的快速说明:

  • 在 Eclipse 中,右键单击您的项目-->导入
  • 选择文件系统,然后下一步
  • 浏览 jar 文件的路径,然后按确定
  • 选择(加厚)MySQLDumpSplitter.jar文件,然后完成
  • 它将被添加到您的项目中并显示在 Eclipse 的 Package Explorer 中的项目文件夹中
  • 双击 Eclipse 中的 jar 文件(在 Package Explorer 中)
  • MySQL Dump 文件拆分器窗口打开,您可以在其中指定转储文件的地址并继续split
于 2015-06-22T19:36:44.523 回答
0

它不漂亮(因为它只是按大小拆分,而不是按文件中的逻辑拆分),但您可以使用 unix 拆分工具来完成此操作:

mysqldump mydb | split -b 100m mydbbackup

确保检查手册页是否拆分,您的副本可能接受也可能不接受 100m 大小参数。有些需要以字节为单位指定大小。

当您从文件中恢复时,您必须使用 cat 将它们重新组合在一起。

cat mydbbackup.1 mydbbackup.2 mydbbackup.3 | mysql
于 2010-10-01T15:57:40.957 回答
0

您可以使用 mysql_export_explode https://github.com/barinascode/mysql-export-explode

<?php 
#Including the class

include 'mysql_export_explode.php';
$export = new mysql_export_explode;

$export->db = 'dataBaseName'; # -- Set your database name
$export->connect('host','user','password'); # -- Connecting to database
$export->rows = array('Id','firstName','Telephone','Address'); # -- Set which fields you want to export
$export->exportTable('myTableName',15); # -- Table name and in few fractions you want to split the table
?>

At the end of the SQL files are created in the directory where the script is executed in the following format
---------------------------------------
myTableName_0.sql
myTableName_1.sql
myTableName_2.sql
...
于 2016-02-21T02:44:54.993 回答