How to import a csv file into MySQL workbench?

前端 未结 7 1594
野的像风
野的像风 2020-11-30 18:03

I have a CSV file. It contain 1.4 million rows of data, so I am not able to open that csv file in Excel because its limit is about 1 million rows.

Therefore, I want

7条回答
  •  無奈伤痛
    2020-11-30 18:11

    At the moment it is not possible to import a CSV (using MySQL Workbench) in all platforms, nor is advised if said file does not reside in the same host as the MySQL server host.

    However, you can use mysqlimport.

    Example:

    mysqlimport --local --compress --user=username --password --host=hostname \
    --fields-terminated-by=',' Acme sales.part_*
    

    In this example mysqlimport is instructed to load all of the files named "sales" with an extension starting with "part_". This is a convenient way to load all of the files created in the "split" example. Use the --compress option to minimize network traffic. The --fields-terminated-by=',' option is used for CSV files and the --local option specifies that the incoming data is located on the client. Without the --local option, MySQL will look for the data on the database host, so always specify the --local option.

    There is useful information on the subject in AWS RDS documentation.

提交回复
热议问题