8

I am using : WampServer 2.2, Apache Version :2.2.21, PHP Version : 5.3.8, MySQL Version :5.5.16, PhpMyadmin Version: 3.4.5...

I have face Problem Of Importing CSV file-(size 13MB*), Error File is Too large... phpMyadmin allow only 2MB file size ...

So Separate files with 1.83MB file size...then also it does not work ???

And also tell me , How to automatic create table through CSV file ...?

1
  • what error do you get when you try with 1.83 mb files?
    – Techmonk
    Feb 19, 2013 at 6:49

8 Answers 8

10

Why dont you try to import file using MySQL Console?
I think, you will not face any problem this way. You will not need to split the file into chunks. Just take care of syntax.

load data infile 'c:/filename.csv' into table tablename fields terminated by ',';

For details about syntax, refer Load Data Infile on official documentation.
For example, refer this and this.

Hope it helps!!!

1
  • If my suggestion has helped you, can you please upvote or accept answer? Feb 22, 2013 at 5:57
4

LOAD DATA INFILE 'your.csv' INTO TABLE android_dev FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;

include the csv file in your database folder,i.e., <root>\mysql\data\DATABASE_NAME

1

I'd suggest you look at Data Transformer (disclaimer - I'm its developer). It can convert CSV/JSON/XML to SQL. The generated SQL contains "insert" statements for each line and a "create table" statement.

The app works offline and your data never leaves your computer.

You can get it from the Mac App Store or the Microsoft Store.

1

How to automatic create table through CSV file ...?

I wrote a csv2mysql command. It scans the entier CSV file to determine appropriate column types and outputs a CREATE TABLE statement and (optionally) INSERT INTO statements for the data.

It's at https://github.com/artfulrobot/csv2mysql (you can just download the bin/csv2mysql executable (Linux) or you can run the main csv2mysql.php file if you download the source and run composer install)

0

One of the best option which i frequently use is rebasedata, they allow around 200 MB (CSV to MySQL, which I tested) in their free plan.

Checkout yourself here https://www.rebasedata.com/convert-csv-to-mysql-online

0

Use https://csvtosql.com online CSV to SQL converter tool. Paste your CSV lines and Convert them to SQL queries. Then you can save them in a SQL file or directly run them on SQL console on phpmyadmin

screenshot

1
  • 1
    This answer might be a security risk dependending on the data to be converted!
    – PowerStat
    Apr 12, 2019 at 8:24
0

You can do this easily using sqlizer.io. Here's a screenshot:

Screenshot of sqlizer.io

Just select "Comma Separated Values" for the file type and upload your file. It will analyse the data and generate an SQL script containing an appropriate CREATE TABLE statement, and a lot of INSERT statements.

(Disclaimer: I help run SQLizer)

3
  • 1
    By not disclosing your affiliation, this is considered SPAM. d4nt.com/… Oct 1, 2019 at 8:35
  • 1
    @TiagoMartinsPeres ok, I've added a disclaimer. It's a freemium tool that I run part time and I was only trying to be helpful.
    – d4nt
    Oct 1, 2019 at 8:54
  • 1
    Understandable. I've done a quick search and most of the posts including sqlizer.io were from you and / or other team members and none disclose the affiliation. Oct 1, 2019 at 8:56
-1

Go to ..\xampp\php\php.ini

and change following...

    php_value upload_max_filesize xxxxM //file size
    php_value post_max_size xxxxM
    php_value max_execution_time xxxx
    php_value max_input_time xxxx

put xxxx your desire value 1M = 1mb

You most restart your server after changing...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.