I'm trying to import about 20 .csv files into MySQL and I'm fed up with doing it via phpmyadmin's import gui.
我正在尝试将大约20个.csv文件导入MySQL,我厌倦了通过phpmyadmin的import gui进行操作。
Is there a way to do this by batch without typing on the command line? i.e. a script that will run when double clicked (Windows). What I want is:
有没有办法在批处理的情况下批量执行此操作而不在命令行上输入?即双击时运行的脚本(Windows)。我想要的是:
- I have files like porsche.csv, ferrari.csv etc
- I want to import each of these into tables with the same name (i.e. porsche, ferrari)
- Empty the table before importing the text file (using
delete
flag). How does it handle new fields? - Ignore first line (header).
我有像porsche.csv,ferrari.csv等文件
我想将这些中的每一个导入到同名的表中(即保时捷,法拉利)
在导入文本文件之前清空表(使用删除标志)。它如何处理新字段?
忽略第一行(标题)。
From what I've gathered so far: we use mysqlimport
: http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html
从我到目前为止收集到的内容:我们使用mysqlimport:http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html
I'll try to fiddle around with the options and see if I can get something working.
我会尝试摆弄各种选项,看看能不能搞定。
1 个解决方案
#1
0
On Windows, the easiest way is to use a batch script.
在Windows上,最简单的方法是使用批处理脚本。
Read the documentation on available options.
阅读有关可用选项的文档。
The batch script would look something like:
批处理脚本看起来像:
@echo off
cd C:\Program Files\MySQL\MySQL Workbench 5.2 CE\
mysqlimport ...
Other related questions:
其他相关问题:
- Import multiple CSV files into mysql
- How do I import data from a .bat file in MySQL?
将多个CSV文件导入mysql
如何从MySQL中的.bat文件导入数据?
#1
0
On Windows, the easiest way is to use a batch script.
在Windows上,最简单的方法是使用批处理脚本。
Read the documentation on available options.
阅读有关可用选项的文档。
The batch script would look something like:
批处理脚本看起来像:
@echo off
cd C:\Program Files\MySQL\MySQL Workbench 5.2 CE\
mysqlimport ...
Other related questions:
其他相关问题:
- Import multiple CSV files into mysql
- How do I import data from a .bat file in MySQL?
将多个CSV文件导入mysql
如何从MySQL中的.bat文件导入数据?