Solve the problem that phpMyAdmin can import data files up to 2 MB

Source: Internet
Author: User
Tags file size ini memory usage time limit website server zip mysql database phpmyadmin

PhpMyAdmin is easy to use and has become a common tool for most webmasters. phpmyadmin is more than enough for small websites. However, when the database is large for medium and large websites, phpmyadmin seems to be powerless!

When the size of the database imported using phpMyAdmin is greater than 2 MB, the following prompt is displayed:
No data was passed Ed to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

In general, phpMyAdmin can upload files up to 2 MB. However, after a website is running for a period of time, even if the SQL-format database is compressed into zip format, it is unrealistic to change it to 2 MB or less.
I personally do not recommend using phpMyAdmin to import large databases because most users use virtual hosts and many files cannot be modified without server permissions, phpmyadmin has a low execution efficiency on large databases and is prone to errors.


Solution for importing large databases

We recommend that you use the BigDump tool to import large databases. For the download address and usage instructions, see: Use the BigDump tool to import large MySQL database backup files.
If you are persistent in using phpmyadmin for database import, you can find a lot of information on the network, but most of them are incomplete and only solve some problems, therefore, I have developed a relatively reliable solution,
The following are some methods I have collected to solve the limit on the size of phpMyAdmin uploaded files.

Solution 1 (simple)

Open the configuration file config. inc. php under phpmyadmin.

The code is as follows: Copy code
Search
$ Cfg ['uploaddir'] = ";
$ Cfg ['savedir'] = ";
Assign values to them
$ Cfg ['uploaddir'] = 'upload ';
$ Cfg ['savedir'] = 'save ';

After modification, if the system prompts "the configuration file requires a top secret phrase password (blowfish_secret )." Don't worry,

Create two empty directories, upload and save under the phpMyAdmin directory, and transfer the database files to be imported (which must be in the SQL format and not in the zip format) to the upload directory.
Log on to phpMyAdmin and click import to find that a folder is uploaded to the website server.


Select the database in the folder uploaded by the website server, and click execute to import the super large database.
Solution 2 (tedious)

Open the PHP configuration file php. ini

Find upload_max_filesize and post_max_size to increase their values.
If the file to be uploaded is large, make the following changes:

The code is as follows: Copy code
Max_execution_time (php page execution maximum time)
Max_input_time (maximum time for receiving data on the php page)
Memory_limit (maximum memory occupied by php pages)

This is because when phpmyadmin uploads a large file, the execution time and memory usage of the php page will inevitably become larger. It requires the cooperation of the php runtime environment and it is not enough to modify the size limit of the uploaded file.
Open the config. inc. php file in the phpmyadmin directory.
Find the configuration option $ cfg ['exectimelimmit ']. The default value is 300. You need to change it to 0, that is, there is no time limit.

Open the import. php file in the phpmyadmin directory and modify the value of $ memory_limit.

Description: php is preferred. the memory configuration option memory_limit in The ini configuration file. If it is null, the default memory size is limited to 2 MB. If there is no limit, the memory size is limited to 10 MB. You can combine your php. modify the code in the ini configuration file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.