Home >Database >Mysql Tutorial >How to Import a CSV File into an Existing MySQL Table Using phpMyAdmin?

How to Import a CSV File into an Existing MySQL Table Using phpMyAdmin?

Susan Sarandon
Susan SarandonOriginal
2024-10-26 06:37:30610browse

How to Import a CSV File into an Existing MySQL Table Using phpMyAdmin?

Importing a CSV File into an Existing MySQL Table Using phpMyAdmin

Importing a CSV file into an existing database can be a convenient way to populate your data. While phpMyAdmin may initially create a new table with generic column names upon importing a CSV, it is possible to insert the data directly into your existing table.

Step-by-Step Guide to Inserting CSV Data into an Existing Table

  1. Open phpMyAdmin and select the target database.
  2. Navigate to the Import tab.
  3. Browse for and select the CSV file.
  4. Leave the character set as is.
  5. Select "CSV" as the format.
  6. Check "Replace table data with file" to truncate the existing table before importing.
  7. Uncheck "partial import" unless dealing with a large dataset.
  8. Set the following field delimiters:

    • Fields terminated by: ,
    • Fields enclosed by: "
    • Fields escaped by:
    • Lines terminated by: auto
  9. Click the "Go" button.

Customizing Column Names

By default, phpMyAdmin will use the first row of the CSV file as column names. However, if the CSV file does not contain header rows, you can manually specify column names by clicking on the "Options" tab.

Once the data is imported, you can check the table to verify that the values were inserted successfully.

The above is the detailed content of How to Import a CSV File into an Existing MySQL Table Using phpMyAdmin?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn