Search
Generic filters
Exact matches only
  • Import csv to phpmyadmin

    29th January 2021

    MySql

    mysql codehaven category

    Updated 29/01/2021

    Simple but can cause lots of problems.

    I have one column with 200,000 postcode entries! in a CSV file. One Tab. Like below

    My first insert of 4000 was quick without error, but the 200,000 had import errors.

    I tried many Free CSV splitters online but all had problems except one!

    https://textfilesplitter.com/

    So I cut into 4 CSV files of 50,000 each and this worked (took about 12 seconds).
    Now I needed to add to this column with the other imports.

    I tried another imports, but now I had four tables.

    I changed there names as they had a space in them.

    Click on table > operations > change name

    So I used SQL

    (on this last table I forgot to take off the tick on enable foreign key, but it did not make a difference!)

    I did notice the row count did not add up correctly, but after a refresh it changed.
    innoDB tables count differently!

    Now I had this: –

    after deleting unused tables : –

    Follow this instructio to import CSV:

    Go to the Import tab
    Browse and select your CSV file

    Select “CSV”

    Turn off enable foreign key checks: –


    In the “Fields terminated by” field, change “;” to “,”
    Click on “Go”

    Was this code snippet helpful?

    Comment on this Code Snippet?