20

I've been trying to upload large data into my testing server, I've modified a few files so far:

php.ini

memory_limit=2048M
php_value post_max_size 2048M
php_value upload_max_filesize 2048M

my.ini

key_buffer = 32M
max_allowed_packet = 2048M
sort_buffer_size = 32M
net_buffer_length = 32M
read_buffer_size = 32M
read_rnd_buffer_size = 32M
myisam_sort_buffer_size = 64M

I can upload larger files, about 50mb, but I still receive the following error when trying to upload files around 200mb:

Fatal error: Out of memory (allocated 1161822208) (tried to allocate 462046611 bytes) in C:\Program Files\xampp\phpMyAdmin\libraries\insert_edit.lib.php on line 1879

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Tehort
  • 209
  • 2
  • 3
  • 4

7 Answers7

48

Apply in php.ini

post_max_size = 750M 
upload_max_filesize = 750M 
max_execution_time = 5000 
max_input_time = 5000 
memory_limit = 1000M 

Then restart wamp/lampp/xampp for the changes to take effect It will take long time. If you get following error "Script timeout passed if you want to finish import please resubmit same zip file and import will resume"

Then in phpMyAdmin

phpMyAdmin\libraries\config.default.php

/**
 * maximum execution time in seconds (0 for no limit)
 *
 * @global integer $cfg['ExecTimeLimit']
 */
$cfg['ExecTimeLimit'] = 0;

Change it

railsbox
  • 868
  • 8
  • 18
18

Source: How to Import Large Database Files in XAMPP

Make changes in xampp\php\php.ini

Look for the following:

post_max_size       = 8M
upload_max_filesize = 2M
max_execution_time  = 30
max_input_time      = 60
memory_limit        = 8M

then replace the lines with the following:

post_max_size       = 750M
upload_max_filesize = 750M
max_execution_time  = 5000
max_input_time      = 5000
memory_limit        = 1000M

Restart your XAMPP after making the changes, if you are still seeing the same error – try restarting your computer.

Carl
  • 805
  • 12
  • 24
8

Try to import the MySQL data via commandline if possible.

mysql -u user -p database < dump.sql
tholu
  • 1,150
  • 2
  • 10
  • 24
4

Alternatively instead of parsing up your SQL you could just do a mysql import via the shell:

using this CMD: mysql -p -u username database_name < file.sql

Read directions here how to turn on shell via Xampp here

Community
  • 1
  • 1
rrrcode
  • 107
  • 3
  • 10
1

If you using xampp

C:\xampp\mysql\bin\mysql -u root -p databasename < C:/mysql.sql

check your database name and drive or username!

Pedram
  • 15,766
  • 10
  • 44
  • 73
0

Just change these two values.

upload_max_filesize = 200M

max_execution_time = 60000

Abid Shah
  • 325
  • 3
  • 5
-2

Command-Line Tools (Shell) to import large database SQL file

  • username – your MySQL username. e.g. root
  • database_name – database name you are importing to
  • /path/file.sql – full path to your .sql file

when you haven’t created a MySQL username. In that case, you need to type “root” for the username.

mysql -u root -p Database_name < "/path/file.sql"

Via command line:- Here

  • 2
    A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it is there, then quote the most relevant part of the page you are linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](/help/deleted-answers) –  May 04 '22 at 17:15