MySQL 导出大型数据库mysql phpmyadmin

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20028898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:26:33  来源:igfitidea点击:

export large database mysql phpmyadmin

mysqlphpmyadminfatal-error

提问by ahajib

I am using phpmyadmin on my windows os. I have a database with one table which has 100M records with the size of 20GB. I want to export this table and have the table.sql file. Whenever I try to do this, the size of the exported file is 0 bytes. When I check the apache error log, the following would show up:

我在 Windows 操作系统上使用 phpmyadmin。我有一个包含一个表的数据库,其中有 100M 条记录,大小为 20GB。我想导出这个表并拥有 table.sql 文件。每当我尝试这样做时,导出文件的大小为 0 字节。当我检查 apache 错误日志时,会显示以下内容:

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1066139648 bytes)

Any idea how to solve this problem?!

知道如何解决这个问题吗?!

Thanks :)

谢谢 :)

回答by user2196728

I would suggest to try using the command line and the mysqldump.exe utility, as suggested here

我建议尝试使用命令行和 mysqldump.exe 实用程序,如建议here

回答by Indrasinh Bihola

If you have shared hosting and you are using GoDaddy Cpanelthan they are providing you option to backup your database in following section.

如果您有共享主机并且您使用的是GoDaddy Cpanel,那么他们会在以下部分为您提供备份数据库的选项。

Files=> Backup=> Download a MySQL Database Backup.

文件=>备份=>下载 MySQL 数据库备份

回答by numediaweb

If you are on a shared hosting or you don't have access to shell, then use mysqldumperscript; copy it to your server and start it in your browser under "yourDomain.com/path_to_mysqlumper/"

如果您在共享主机上或者您无权访问 shell,则使用mysqldumper脚本;将其复制到您的服务器并在浏览器中的“yourDomain.com/path_to_mysqlumper/”下启动它

MySQLDumper is a PHP and Perl based tool for backing up MySQL databases. You can easily dump your data into a backup file and - if needed - restore it. It is especially suited for shared hosting webspaces, where you don't have shell access.

MySQLDumper 是一个基于 PHP 和 Perl 的备份 MySQL 数据库的工具。 您可以轻松地将数据转储到备份文件中,并在需要时恢复它。 它特别适用于您没有 shell 访问权限的共享主机空间。

MySQLDumper is a PHP and Perl based tool for backing up MySQL databases. You can easily dump your data into a backup file and - if needed - restore it. It is especially suited for shared hosting webspaces, where you don't have shell access.

MySQLDumper 是一个基于 PHP 和 Perl 的备份 MySQL 数据库的工具。您可以轻松地将数据转储到备份文件中,并在需要时恢复它。它特别适用于您没有 shell 访问权限的共享主机空间。

If you have shell access to your host servers (if provided by your host since not all shared server hosters give this access) then you may use SSH access like in this tutorialusing Puttythat you install and configurethen import or export your databases like in this third tutorial.

如果您对您的主机服务器具有 shell 访问权限(如果由您的主机提供,因为并非所有共享服务器主机都提供此访问权限),那么您可以使用本教程中的SSH 访问,使用您安装和配置的Putty,然后导入或导出您的数据库,如这第三个教程

回答by tom

MySQLDumper worked like a charm for me at my hosted website. I had to copy one database and "paste" it into a new database. In MySQLDumper, it isn't apparent right away how to do this, but the key is to create a new configuration file in MySQLDumper and that will allow you to copy/restore to different databases.

MySQLDumper 在我的托管网站上对我来说就像一个魅力。我不得不复制一个数据库并将其“粘贴”到一个新数据库中。在 MySQLDumper 中,如何做到这一点并不是很明显,但关键是在 MySQLDumper 中创建一个新的配置文件,这将允许您复制/恢复到不同的数据库。

On the home screen in MySQLDumper, click Configuration, then Configuration Files. There is a text box at the top allowing you to create a new Configuration file. In there, put in the information for the second database you need (you created a connection to the first database when you install MySQLDumper). Save it. Then you can click Restore where you can select the dump of the first database and restore it in the second one.

在 MySQLDumper 的主屏幕上,单击配置,然后单击配置文件。顶部有一个文本框,允许您创建新的配置文件。在那里,输入您需要的第二个数据库的信息(您在安装 MySQLDumper 时创建了到第一个数据库的连接)。保存。然后您可以单击恢复,您可以在其中选择第一个数据库的转储并在​​第二个数据库中恢复它。

This was a lifesaver. Thanks!

这是救命稻草。谢谢!

回答by Jitendra Pawar

increase

增加

max_post_size

max_post_size

variable in php.ini file. Then you will be able to download it.

php.ini 文件中的变量。然后你就可以下载它了。

回答by Vikas Kandari

I had a different issue when I was downloading from phpmyadmin in the middle like 180MB download stops with message - network error

我在中间从 phpmyadmin 下载时遇到了一个不同的问题,比如 180MB 下载停止并显示消息 - 网络错误

So I used ssh connection which you can find in your cpanel sometimes they provide browser based terminal or sometime you have to access it using putty .

所以我使用了 ssh 连接,你可以在你的 cpanel 中找到它,有时它们提供基于浏览器的终端,或者有时你必须使用 putty 访问它。

In terminal I go inside my public_htmlfolder where all my files are stored . Followed by this command:

在终端中,我进入public_html存储我所有文件的文件夹。后面跟着这个命令:

mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]

This did the job in few minutes and saved a sql file in my public_htmlfolder. Then I opened the folder in File manager and downloaded it from there.

这在几分钟内完成了工作,并在我的public_html文件夹中保存了一个 sql 文件。然后我在文件管理器中打开文件夹并从那里下载。

You can also use FTP or you can download it directory by accessing by url.

您也可以使用 FTP 或您可以通过 url 访问下载它的目录。

Make sure you delete it after your download finishes.

确保在下载完成后将其删除