Section: imports, exports, and mysql shell utilities

Load CSV data into a table

sql
sql
LOAD DATA INFILE '/var/lib/mysql-files/users.csv'
INTO TABLE users_staging
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(email, full_name);
Explanation

Much faster than many single-row inserts for bulk imports.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing imports, exports, and mysql shell utilities
Export query results to CSV-like output
Write rows to a server-side file.
OpenIn sheetsqlsame section
Import delimited text with mysqlimport
Use the mysqlimport command-line utility.
OpenIn sheetbashsame section
Dump an instance with MySQL Shell
Use MySQL Shell utilities for scalable dumps.
OpenIn sheetbashsame section
Load a MySQL Shell dump
Restore a dump created by MySQL Shell utilities.
OpenIn sheetbashsame section
Restore from a SQL dump
Load a dump file into MySQL.
OpenIn sheetbash1 tag match
Dump one database
Export schema and data from one database.