Hello All,

Need help in importing CSV files into Mysql. I have tried all the methods which I can think of but im not able to import it. attach is the CSV file which Im trying to import.

Below is my MYSQL table structure:
mysql> show columns from test;
+---------------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+----------+------+-----+---------+----------------+
| id | int(50) | NO | PRI | NULL | auto_increment |
| Date | longtext | NO | | NULL | |
| User | longtext | NO | | NULL | |
| Host | longtext | NO | | NULL | |
| Domain | longtext | NO | | NULL | |
| Activity | longtext | NO | | NULL | |
| Justification | longtext | NO | | NULL | |
| Offline | longtext | NO | | NULL | |
| Destination | longtext | NO | | NULL | |
| Policy_Name | longtext | NO | | NULL | |
| Compliance_Template | longtext | NO | | NULL | |
| Action | longtext | NO | | NULL | |
| Document_Path | longtext | NO | | NULL | |
| Content_Type | longtext | NO | | NULL | |
| Content | longtext | NO | | NULL | |
| Matched_Doc_Path | longtext | NO | | NULL | |
+---------------------+----------+------+-----+---------+----------------+

Regards
BW

Hi,

Below is the query I'm running to import the data.

LOAD DATA INFILE "C:/arichivedlog.csv"
INTO TABLE `dlp`.`test`
FIELDS TERMINATED BY ' '
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r';


I have tried to after changing
FIELDS TERMINATED BY ' '

to
FIELDS TERMINATED BY ';'
FIELDS TERMINATED BY ','
FIELDS TERMINATED BY '\t'

but data is not importing.

are you getting any error message ?

LOAD DATA INFILE "C:/arichivedlog.csv"

from above looks like you are importing from your local computer
try
LOAD DATA LOCAL INFILE "C:/arichivedlog.csv"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.