Home > Database > Mysql Tutorial > How do I perform a bulk insert in MySQL?

How do I perform a bulk insert in MySQL?

Barbara Streisand
Release: 2024-11-28 22:59:10
Original
869 people have browsed it

How do I perform a bulk insert in MySQL?

Bulk Inserting Data in MySQL

Inserting large volumes of data into a MySQL database can be a daunting task. On Microsoft SQL Server, you can perform bulk inserts using the BULK INSERT command. However, MySQL offers its own unique approach for this operation using the LOAD DATA INFILE statement.

LOAD DATA INFILE

The LOAD DATA INFILE statement allows you to import data from a text file or an external data source directly into a MySQL table. Its syntax is as follows:

LOAD DATA INFILE <file_path>
INTO TABLE <table>
FIELDS TERMINATED BY <delimiter>
[LINES TERMINATED BY <line_delimiter>]
[(field_options)]
Copy after login

Where: