Google Cloud SQL - LOAD DATA LOCAL INFILE

1.5k views Asked by At

I am running a web server using a google cloud compute engine vm and I am trying to dump a cvs file into the database. I know LOAD DATA INFILE is not supported, however LOAD DATA LOCAL INFILE is. How do I use LOAD DATA LOCAL INFILE?

1

There are 1 answers

0
m00 On BEST ANSWER

As suggested in this question, you can use LOAD DATA LOCAL INFILE to accomplish this task.

The command syntax is as follows:

LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE tbl_name [CHARACTER SET charset_name] [{FIELDS | COLUMNS} [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char'] ] [LINES [STARTING BY 'string'] [TERMINATED BY 'string'] ] [IGNORE number {LINES | ROWS}] [(col_name_or_user_var,...)] [SET col_name = expr,...]

For more information, please refer to the MySQL documentation.