How do I import data into MySQL

To import data into MySQL database, you can use various methods such as using command line tools, MySQL Workbench, or executing SQL commands. Below is an example of how to import data from a CSV file using the command line.

-- First, make sure your CSV file is properly formatted. -- Then you can use the following command to import it into a MySQL table: LOAD DATA INFILE '/path/to/your/file.csv' INTO TABLE your_table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS; -- If your CSV has a header

MySQL import data CSV command line SQL commands database management