SQL Importing Large CSV, Out of Memory Error

2019-08-03 18:47发布

问题:

I am trying to import a large (65mb) CSV file into a SQL table. I am using phpMyAdming and xampp. I have changed the following settings in php.ini:

memory_limit = 6000M
post_max_size = 128M
upload_max_filesize = 128M

When I try this I get error 'Fatal error: Out of memory (allocated 1852047360) (tried to allocate 262145 bytes) in C:\xampp\phpMyAdmin\libraries\import.lib.php on line 294'

What can I do to solve this error? I would also like to import a much larger database as well.

回答1:

Could you break the file up into chunks?



回答2:

You could write a Python/PHP/Ruby script to read the file and parse the data, and run INSERT statements row by row.