Problem:
Importing a CSV file into a MySQL table fails, resulting in an empty table filled with NULL values. The source file contains multiline text data, leading to incorrect data parsing.
Solution:
When importing a CSV file into a MySQL table, consider the following steps to handle multiline text data and ensure correct data placement:
Use mysqlimport utility to import the table data into the database. This tool provides more control over the import process.
mysqlimport --ignore-lines=1 \ --fields-terminated-by=, \ --local -u root \ -p Database \ TableName.csv
Specify additional import options if necessary:
By following these steps, you can effectively import CSV files with multiline text data into MySQL tables, ensuring accurate data representation.
The above is the detailed content of How to Import a CSV File with Multiline Text Data into MySQL?. For more information, please follow other related articles on the PHP Chinese website!