我正在尝试使用终端或 phpmyadmin 上传大小为 150MB
的 .sql 文件,但出现错误
这是我在导入文件之前所做的
在php.ini
文件中
1)post_max_size = 20000M
2)upload_max_filesize = 20000M
3)max_execution_time = 50000
4)max_input_time = 50000
5)memory_limit = 20000M
& 在/etc/mysql/my.cn
6)max_allowed_packet = 2G
& 在/usr/share/phpmyadmin/libraries/config.defalut.php
$cfg['ExecTimeLimit'] = '0'; //to make it unlimited, this was 300 default
即使经过这么多设置,我仍然收到错误: 当从终端尝试时
mysql -u root -p dbname < mydbfile.sql & then entered the password & got the
error: ERROR 2006 (HY000) at line 23: MySql server has gone away
当我在花费 3-4 小时后尝试使用 phpmyadmin 导入数据库文件时,也会导致错误
喜欢:没有收到数据
有没有其他方法,比如使用php读取.sql文件并一一插入数据库。这是好方法吗?
知道可能是什么问题吗?
提前致谢!
最佳答案
我认为您应该拆分 .sql 插入命令并分多个阶段导入它们。请检查“最大连接时间”设置。
关于php - 如何从终端或 phpmyadmin 导入大小为 150MB 的 .sql 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17828234/