MySQL Xampp - PHPMyAdmin 上传大文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18343863/
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
Xampp - PHPMyAdmin upload large files?
提问by Tehort
I've been trying to upload large data into my testing server, I've modified a few files so far:
我一直在尝试将大数据上传到我的测试服务器,到目前为止我已经修改了一些文件:
php.ini
配置文件
memory_limit=2048M
php_value post_max_size 2048M
php_value upload_max_filesize 2048M
my.ini
我的.ini
key_buffer = 32M
max_allowed_packet = 2048M
sort_buffer_size = 32M
net_buffer_length = 32M
read_buffer_size = 32M
read_rnd_buffer_size = 32M
myisam_sort_buffer_size = 64M
I can upload larger files, about 50mb, but I still receive the following error when trying to upload files around 200mb:
我可以上传更大的文件,大约 50mb,但在尝试上传大约 200mb 的文件时,我仍然收到以下错误:
Fatal error: Out of memory (allocated 1161822208) (tried to allocate 462046611 bytes) in C:\Program Files\xampp\phpMyAdmin\libraries\insert_edit.lib.php on line 1879
致命错误:第 1879 行的 C:\Program Files\xampp\phpMyAdmin\libraries\insert_edit.lib.php 内存不足(已分配 1161822208)(试图分配 462046611 字节)
回答by railsbox
Apply in php.ini
在 php.ini 中申请
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
Then restart wamp/lampp/xampp for the changes to take effect It will take long time. If you get following error "Script timeout passed if you want to finish import please resubmit same zip file and import will resume"
然后重启wamp/lampp/xampp,让修改生效需要很长时间。如果您收到以下错误“脚本超时已过,如果您想完成导入,请重新提交相同的 zip 文件,导入将恢复”
Then in phpMyAdmin
然后在 phpMyAdmin
phpMyAdmin\libraries\config.default.php
phpMyAdmin\libraries\config.default.php
/**
* maximum execution time in seconds (0 for no limit)
*
* @global integer $cfg['ExecTimeLimit']
*/
$cfg['ExecTimeLimit'] = 0;
Change it
更改
回答by Carl
Source: How to Import Large Database Files in XAMPP
Make changes in xampp\php\php.ini
在 xampp\php\php.ini 中进行更改
Look for the following:
查找以下内容:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
then replace the lines with the following:
然后用以下内容替换这些行:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
Restart your XAMPP after making the changes, if you are still seeing the same error – try restarting your computer.
进行更改后重新启动 XAMPP,如果您仍然看到相同的错误 - 尝试重新启动计算机。
回答by rrrcode
Alternatively instead of parsing up your SQL you could just do a mysql import via the shell:
或者,您可以通过 shell 执行 mysql 导入,而不是解析您的 SQL:
using this CMD: mysql -p -u username database_name < file.sql
使用此 CMD: mysql -p -u username database_name < file.sql
Read directions here how to turn on shell via Xampp here
在此处阅读说明如何在此处通过 Xampp 打开外壳
回答by tholu
Try to import the MySQL data via commandline if possible.
如果可能,尝试通过命令行导入 MySQL 数据。
mysql -u user -p database < dump.sql
回答by Abid Shah
Just change these two values.
只需更改这两个值。
upload_max_filesize = 200M
upload_max_filesize = 200M
max_execution_time = 60000
最大执行时间 = 60000