Home >Database >Mysql Tutorial >What should I do if the file imported into mysql database is too large?

What should I do if the file imported into mysql database is too large?

coldplay.xixi
coldplay.xixiOriginal
2020-09-28 13:22:212813browse

The solution to the problem that the file imported by mysql into the database is too large: first open [php.ini] and find the relevant parameters; then make relevant modifications according to the actual performance configuration of the server; then after the modification is completed, restart the system; finally Just execute the import command again.

What should I do if the file imported into mysql database is too large?

Solution to the problem that the file imported by mysql into the database is too large:

Step one: Open php.ini and find the three parameters upload_max_filesize, memory_limit and post_max_size!

What they represent are:

  • upload_max_filesize Limit the maximum size of uploaded files.

  • post_max_size Set the maximum size allowed for POST data.

  • memory_limit               Sets the maximum number of memory bytes that a script can apply for.

(By default, PHP only allows the maximum upload data to be 2M, which is 2048KB, and the maximum memory_limit used is only 128M, and the maximum Post size is also 2M)

Second step:Make the following modifications according to the actual performance configuration of the server:

  • upload_max_filesize =8M (the maximum upload limit is set to 8M, enough for general file WEB upload)

  • memory_limit =512M (if the server’s memory is 2GB, it can be set to 512M here)

  • post_max_size =8M (the maximum value of Post data is also set to 8MB, which is the same as upload_max)

Step 3:After modification, restart the system, and then After executing the import command, you will be prompted:

Import has been successfully finished,499 queries executed.

(Successful import, 499 requests were successfully processed...)

But for students who use virtual hosts that do not support custom php.ini Say, you have to think of other ways.

There is also a method here: split the data file and then import it step by step!

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of What should I do if the file imported into mysql database is too large?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn