简体   繁体   English

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

[英]import csv file to mysql remote server using mysqlimport

I have 4 csv files that I want to import into my AWS mysql database. 我有4个要导入到我的AWS mysql数据库中的csv文件。

I am trying to use the following command from a windows machine: 我正在尝试从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"

The response that I get is this: 我得到的响应是这样的:

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

Do you actually have a file named "tickets" that you are trying to import? 您实际上是否有一个试图导入的名为“ tickets”的文件? It sort of looks like you are trying to pass in a table name. 看起来您正在尝试传递表名。 Based on the documentation , I think you need to rename Data_2014_1.csv to tickets.csv and then run the following command: 根据该文件 ,我想你需要重命名Data_2014_1.csvtickets.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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM