How to upload / import a mysql phpmydadmin database of more than 2MB

时间:2023-02-12 01:51:36


There is a couple of ways.

1) Split your SQL file into multiple 2MB chunks

OR

2) update your php.ini file with the following (only works on dedicated/local servers - any server you have root on or ones that allow php.ini to be override)

(要修改好几个地方哦)

Find:
post_max_size = 8M

upload_max_filesize = 2M

max_execution_time = 30

max_input_time = 60

memory_limit = 8M


Change to: ( or any size you want but it will depend on your server resources )

post_max_size = 35M
 
 
upload_max_filesize = 35M

max_execution_time = 5000

max_input_time = 5000(这个在程序脚本里动态设置比较好。。)

memory_limit = 1000M

3) If you do have root run a command line

mysql -u database_name -p -D database_name < file

max_input_time 
    此变量可以以秒为单位对通过POST、GET以及PUT方式接收数据时间进行限制。如果应用程序所运行环境处在低速链路上,则需要增加此值以适应接收数据所需的更多时间。 
    max_input_time = 90 

max_execution_time 
    变量max_execution_time设置了在强制终止脚本前PHP等待脚本执行完毕的时间,此时间以秒计算。当脚本进入了一个无限循环状态 时此变量非常有用。然而,当存在一个需要很长时间完成的合法活动时(例如上传大型文件),这项功能也会导致操作失败。在这样的情况下必须考虑将此变量值增 加,以避免PHP在脚本正在执行某些重要过程的时候将脚本关闭。 

    max_execution_time = 90