php phpMyAdmin 无法导出数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17177832/
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-25 12:26:02  来源:igfitidea点击:

phpMyAdmin can't export database

phpmysqldatabasephpmyadmin

提问by user2444244

I have a VPS machine and I installed phpMyAdmin and inserted the database in. But now when I want to make a backup and export the database, it says:

我有一台 VPS 机器,我安装了 phpMyAdmin 并插入了数据库。但是现在当我想备份并导出数据库时,它说:

Error code 500, Internal Server Error

错误代码 500,内部服务器错误

Here is the error.log: http://pastebin.com/44N4YcAk

这是错误日志:http: //pastebin.com/44N4YcAk

[Tue Jun 18 21:40:16 2013] [error] [client] PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 491520 bytes) in /usr/share/phpmyadmin/libraries/tcpdf/tcpdf.php

[Tue Jun 18 21:40:16 2013] [error] [client] PHP Fatal error: Allowed memory size of 16777216 bytes in /usr/share/phpmyadmin/libraries/tcpdf/tcpdf.php

回答by

you should not be using phpmyadmin for this, you should be using mysqldump. from the command line its

你不应该为此使用 phpmyadmin,你应该使用 mysqldump。从命令行它

mysqldump -uMYSQL-USER -h server -pMYSQL-USER database_name > /path-to-export

from a php script

来自 php 脚本

$command = "mysqldump -uMYSQL-USER -h server -pMYSQL-USER database_name > /path-to-export/file.sql";
exec($command, $output, $return_var);

this is easy to automate with a cronjob

这很容易通过 cronjob 实现自动化

回答by Arash Rabiee

do this command:

执行此命令:

nano /usr/share/phpmyadmin/export.php

press ctrl+w and find:

按 ctrl+w 并找到:

// now export the triggers (needs to be done after the data because

this command used twice in the file after this command you see nested if, so in the nested if change:

此命令在此命令之后的文件中使用了两次,您会看到嵌套的 if,因此在嵌套的 if 中更改:

break 2;

to

break;

in both cases after this your export function will work well

在这之后的两种情况下,您的导出功能都可以正常工作

回答by exussum

It says at the bottom

它在底部说

 PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried to allocate 491520 bytes) in /usr/share/phpmyadmin/libraries/tcpdf/tcpdf.php on line 22694, 

Either your VPS is out of memory or your PHP settings are not allowing more than 16MB of memory to be allocated.

要么您的 VPS 内存不足,要么您的 PHP 设置不允许分配超过 16MB 的内存。

Increase the memory in php.ini or just use mysqldump

增加php.ini中的内存或者直接使用mysqldump

php.ini change

php.ini 更改

memory_limit = 64M  

I strongly recomend using mysqldump though here is an extract from my backup script

我强烈建议使用 mysqldump 虽然这里是我备份脚本的摘录

#!/bin/bash
time=`date +%Y-%m-%d_%H-%M-%S`
mysqldump -u mysqluser -pmysqlpassword --all-databases | 7za a -si database/backup-${time}.sql.7z -p7zpass

That saves the backup in a 7zip file protected by the password 7zpass

将备份保存在受密码保护的 7zip 文件中 7zpass

回答by Mehdi Karamosly

Go through this post, it shows how to increase the memory; or just use command line to import:

通过这篇文章,它展示了如何增加内存;或者只是使用命令行导入:

How to increase memory size for phpmyadmin

如何增加 phpmyadmin 的内存大小

回答by Yamen Ashraf

Tip:

提示:

Change the mysql engine to InnoDB instead of MyISAM, the main purpose is claiming storage after cleaning tables or dropping them.

将mysql引擎更改为InnoDB而不是MyISAM,主要目的是在清理表或删除表后声明存储。