Reputation: 5151
I have tried to load a .csv
file into mysql in many different ways. I have most recently tried
load data local infile 'c:\Users\...csv' into table suppression_list;
which works, but I'm told 0 rows affected
.
I've tried to drop the local
but then it says the file is not found. I've tried to add lines terminated by ...
and fields terminated by ...
but that doesn't seem to make any difference. I've also tried saving the file as .txt
but with no luck. suppression_list
is just one column, email text
.
Here is a snapshot of my data
覧覧覧覧覧
覧覧覧覧覧
#
# Contacts
*****@une.net.co
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
You can see it's just one column of email addresses, some of which look a little funky, I'll admit.
Upvotes: 2
Views: 3460
Reputation: 7722
Do a
LOAD DATA INFILE '...csv'
INTO TABLE myTable
LINES TERMINATED BY '\n'
IGNORE 4 LINES
to ignore the Header lines. If you have created mytable
like
CREATE TABLE mytable (
`email` VARCHAR(255) NULL
)
This results in
6 row(s) affected Records: 6 Deleted: 0 Skipped: 0 Warnings: 0 0.000 sec
Upvotes: 3