使用 mysqlimport 将 csv 文件导入到 mysql 远程服务器

import csv file to mysql remote server using mysqlimport

我有 4 个 csv 文件要导入我的 AWS mysql 数据库。

我正在尝试从 windows 机器上使用以下命令:

"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqlimport.exe" -h myhostname.amazonaws.com -P 3306 -u admin -pmypassword --local --fields-terminated-by=, --lines-terminated-by="\r\n" ticketsdb tickets "Data_2014_1.csv"

我得到的回复是这样的:

mysqlimport: [Warning] Using a password on the command line interface can be insecure.
mysqlimport: Error: 2, File 'tickets' not found (Errcode: 2 - No such file or directory), when using table: tickets

您实际上有一个名为 "tickets" 的文件要导入吗?看起来您正试图传递一个 table 名称。基于 the documentation,我认为你需要将 Data_2014_1.csv 重命名为 tickets.csv 然后 运行 以下命令:

"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqlimport.exe" -h myhostname.amazonaws.com -P 3306 -u admin -pmypassword --local --fields-terminated-by=, --lines-terminated-by="\r\n" ticketsdb tickets.csv