Trying to import CSV file to mySQL

I am new to Python and SQL and have been trying to process a csv file into SQL. I have attempted to use python of course but --local-infile=1 argument is not working.

I have also attempted using the BASH command line to use mysqlimport but to no avail.

Surely there has to be an easy way to process a csv file. I would appreciate any feedback on this.

What you need to do is:

  • Go to the "Databases" tab, and note down your MySQL hostname and username, and the name of the database you want to use (including the username and the dollar sign, eg. johnkraehling$default)

  • In a Bash console, start a MySQL session with:


...replacing the DATABASE_HOSTNAME, DATABASE_USERNAME, and DATABASE_NAME with the values you noted down from the "Databases" tab. Don't forget the single quotes around the database name, they're important.

  • Inside the MySQL session, load the data with:

    LOAD DATA INFILE "/home/johnkraehling/PATH/TO/FILE" ...

    ...replacing PATH/TO/FILE with the path to the file inside your home directory, and adding the extra parameters you need from as per (the MySQL docs)[] where I've put the "..."