Home > Article > Backend Development > Solution to phpmyadmin database import 2048kb_PHP tutorial
1. Open php.ini. Find the three parameters upload_max_filesize, memory_limit and post_max_size!
(By default, PHP only allows the maximum upload data to be 2M, which is 2048KB, and the maximum memory_limit is only 128M, and the maximum Post size is also 2M)
MySQL database management (phpMyAdmin) official latest version
2. Make the following changes based on the actual performance configuration of your server: (Note: The following are the changes based on my server performance and hardware configuration..)
upload_max_filesize = 8M (The maximum upload limit is set to 8M, which should be enough for general file WEB upload)
Memory_limit = 512M (Because the memory of the server is 2GB, so adding it to 512M is not excessive, hehe)
Post_max_size = 8M (The maximum Post data is also set to 8MB, which is the same as upload_max)
3. After making the changes, I re-executed the import command:
Import has been successfully finished, 399 queries executed.
Display the import success prompt.
4. Restart the php environment
phpmyadm error message: You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
It turns out that when using phpmyadmin to import the mysql database, the default mysql database can only import a maximum of 2M. The solution is as follows:
In most cases, the upload_max_filesize in php.ini under the PHP5 folder is modified, but after modifying this, this problem is still prompted;
Then change the following:
Modify PHP.ini
File_uploads on Switch whether to allow file uploads via HTTP. The default is ON
Upload_tmp_dir - Files are uploaded to the server where temporary files are stored. If not specified, the system default temporary folder will be used
Upload_max_filesize 20m Wangwen business, that is, the maximum size of the file allowed to be uploaded. Default is 2M
Post_max_size 30m Refers to the maximum value that can be received by PHP through form POST, including all values in the form. The default is 8M
Description
Generally, after setting the above four parameters, if the network is normal, uploading a large file of 8M will definitely work if only the above four parameters are set. Unless your network really has a 100M/S upload speed, you have to continue to set the following parameters, which is to set its time,
max_execution_time 300 The maximum time value (seconds) for each PHP page to run, the default is 30 seconds
max_input_time 300 The maximum time required for each PHP page to receive data, the default is 60 seconds
Memory_limit 80m The maximum memory consumed by each PHP page. The default is 8M. If the memory of your machine is large enough, you can set it larger
Set the maximum size allowed for POST data. This setting also affects file uploads. To upload large files, this value must be greater than upload_max_filesize.
If memory limit is activated in the configuration script, memory_limit will also affect file upload. Generally speaking, memory_limit should be larger than post_max_size.
If you don’t have permission to modify, we can try
phpmyadmin is a very convenient mysql database management tool that can be used to manage mysql database, import, export, etc.
But there is a problem when phpmyadmin imports mysql. If the database file to be imported is relatively large, the import will fail. Let me teach you a simple and effective way to import a mysql database of any size. In theory, no matter how big your database backup file is, it can be imported.
The method is as follows:
1. Upload the database backup file (such as backup.sql) to the root directory of the website.
2. Save the following code as a mysql.php file and upload it to the root directory of the website.
System(“mysql
-hdbhost -udbuser -ppassword dbname
dbhost
Change to your database server address (tip: the default database server address of a general host is: localhost)
Change dbuser to your database username
Password
Change to your database user password
dbname
Change to your database name
backup.sql represents the file name of the database file uploaded to the root directory of the website through ftp (the file is the decompressed file)