技術メモのかけら

内容はもとより調べたことすら忘れてしまうので個人的なメモです。とにかく短く、結論だけ書いていきます。

MySQLでcsvをimport

mysqlコマンドを実行するマシン上のファイルをimportする。

mysql> load data local infile 'hoge.csv' into table post_code character set sjis fields terminated by ',' enclosed by '"' lines terminated by '\r\n';

エラーになった。

ERROR 1148 (42000): The used command is not allowed with this MySQL version

msqlコマンドのオプションに--local-infile=1を指定しないと駄目らしい。

% mysql --local-infile=1 -u username -ppassword -h hostname

http://dev.mysql.com/doc/refman/4.1/ja/load-data-local.html