Convert CSV file to Mysql database file (.sql)?

I use: 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 a problem importing a CSV file (size 13 MB *), the error file is too large ... phpMyadmin only allows a file size of 2 MB ...

So, separate the files with a file size of 1.83MB ... then this will not work ???

And also tell me how to automatically create a table through a CSV file ...?

+6
source share
6 answers

Why aren't you trying to import the file using the MySQL console?
I think you will not run into any problem this way. You do not need to split the file into pieces. Just take care of the syntax.

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

For syntax details, see Download Infile Data in Official Documentation.
For example, this and this .

Hope this helps !!!

+10
source

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 the database folder, i.e. <root>\mysql\data\DATABASE_NAME

+1
source

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

Screenshot of sqlizer.io

Just select β€œComma Separated Values” for the file type and upload the file. It will analyze the data and generate an SQL script containing the corresponding CREATE TABLE statement and many INSERT statements.

(Disclaimer: I help run SQLizer)

+1
source

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

and change the 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 

enter xxxx your desire value 1M = 1mb

You most likely restart your server after the change ...

0
source

One of the best options that I often use is rebasedata, they allow about 200 MB (from CSV to MySQL, which I tested) in their free plan.

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

0
source

Use the https://csvtosql.com online CSV to SQL converter. Insert CSV strings and convert them to SQL queries. You can then save them in an SQL file or run them directly in the SQL console at phpmyadmin.

Screenshot

-1
source

All Articles