April 18, 201313 yr I'm having a bit of difficulty importing a csv into mysql. Just wondering if someone can give me a bit of direction on a better practice. Basically my csv has around 3000 rows and weighs in around 11MB. Until now i have just been copying the first 100 rows into a seperate csv just to keep the load light for testing. I have simply used the Import function in phpMyAdmin and it has worked fine and simply creates a new table which i can then rename. Now if i use the same practice for the large csv it uploads and then goes to a white screen and doesn't create the new table. I assume this is due to the size of the file and the time it takes to execute. So any ideas ? Thanks in advance folks !
April 21, 201313 yr If you can access the server's shell you can use mysqlimport. Or you can write a simple importer script if you have only ftp access.
April 22, 201313 yr Author Thanks guys .. i got there in the end. Turned out that my server had no issues with the 11MB file size (and it's never gonna get any bigger) .. The problem actually lay with an error in the csv file. What i found was that after opening with OpenOffice Calc and making some amendments OpenOffice was saving all the empty columns. For example .. if you open a csv in OpenOffice and scroll right to your last column, go a little too far right and OpenOffice will just keep adding empty columns. It then save these empty columns with a comma like my example code below. "vehicle_id","dealer_id","make","model","model","Varianttext","price","mileage","reg","year","colour","engine","bodystyle","seller_name","seller_email","seller_phone","title","description","fueltype","numberofdoors","site_link","capid","imagerefs","features","exclude_for_ukdirect","cap_features","transmission","vehicle_type","was_price","date_registered","bhp",-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, So what i did was simply copy the columns into a new Calc database and saved it .. this way all the additional blank columns where gone and it has been working flawlessly since. Thanks for your help and suggestions guys !!
Create an account or sign in to comment