1

I'm trying to import a CSV into MySQL via Phpmyadmin. My file is exported from another software i can't access or control. Sadly, the file "export.csv" contains in line one some "info about the other db" and in line 2 it contains the column names.

Im using the following settings:

file: import.csv
character Set of file: iso-8859-1
Skip this number of queries (for SQL) or lines (for other formats), starting from the first one : 2
format: CSV
columns separated by: ;

but i always get the error "column count not matching in line: 1".

if i delete the two first lines in the csv file, it works perfect.

it looks to me like the skip rows does not work. But why?

5
  • can you get to a sql query window and execute commands ? Commented Dec 1, 2015 at 8:52
  • yes i could, what should i execute? Commented Dec 1, 2015 at 8:57
  • LOAD DATA INFILE like this one but tweaking with [IGNORE number {LINES | ROWS}] Commented Dec 1, 2015 at 9:01
  • do the column names in the CSV match up to the column names in the DB? If not, you may need to fill the Column names field (which only shows up when doing an import into a specific table). Commented Dec 1, 2015 at 9:30
  • i wanna skip the column names... Commented Dec 1, 2015 at 10:22

1 Answer 1

0

You must first select the table into which you want to import the CSV file. You do this by clicking on the table name. Then you can click on the Import Tab. If you use the wrong order in this place, then you will be lead to the only SQL import feature. This will still be the Import Tab, however the CSV import feature will not show up. So make sure that you see this menu Format of imported file with the option CSV directly below. Otherwise you must retry to get to this place.

Number of records(queries) to skip from start: 1

Format of imported file
CSV

CSV using LOAD DATA

SQL

Then you choose CSV and the correct options on the right side:

Fields terminated by ;
Fields enclosed by "
Fields escaped by \
Lines terminated by auto
Column names ...

You must copy the first line of your CSV file and remove the "" and replace the ; by , in order to have the column names. You must insert these column names also here in this form after "Column names" instead of my three dots (...) .

E.g.:

Column names uid,pid,tstamp,crdate,deleted,hidden,starttime,endtime,fe_group,title,subtitle,itemnumber,price,note,image,inStock

The result will be shown like this:

Import has been successfully finished, 94 queries executed.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.