kazu634@kazu634-desktop% mysql -u root -p ~/work/googlemaps [<spanclass="synConstant">3036</span>]
Enter password:
Welcome <spanclass="synSpecial">to</span> the MySQL monitor. Commands <spanclass="synSpecial">end</span><spanclass="synSpecial">with</span> ; <spanclass="synStatement">or</span> \g.
Your MySQL connection id <spanclass="synSpecial">is</span><spanclass="synConstant">59</span>
Server version: <spanclass="synConstant">5.0</span>.<spanclass="synConstant">75</span>-0ubuntu10.<spanclass="synConstant">2</span> (Ubuntu)
<spanclass="synSpecial">Type</span><spanclass="synConstant">'help;'</span><spanclass="synStatement">or</span><spanclass="synConstant">'\h'</span><spanclass="synSpecial">for</span> help. <spanclass="synSpecial">Type</span><spanclass="synConstant">'\c'</span><spanclass="synSpecial">to</span> clear the buffer.
-> LINE TERMINATED <spanclass="synSpecial">BY</span><spanclass="synConstant">"\n"</span>;
ERROR <spanclass="synConstant">1064</span> (<spanclass="synConstant">42000</span>): You have an error <spanclass="synStatement">in</span> your SQL syntax; <spanclass="synSpecial">check</span> the manual that corresponds <spanclass="synSpecial">to</span> your MySQL server version <spanclass="synSpecial">for</span> the right syntax <spanclass="synSpecial">to</span> use near <spanclass="synConstant">'LINE TERMINATED BY "\n"'</span> at line <spanclass="synConstant">3</span>
mysql> LOAD DATA INFILE <spanclass="synConstant">"data.csv"</span>
ERROR <spanclass="synConstant">13</span> (HY000): Can<spanclass="synConstant">'t get stat of '</span>/etc/mysql/work/googlemaps/data.csv<spanclass="synConstant">' (Errcode: 2)</span>
<spanclass="synConstant">mysql> LOAD DATA INFILE "/home/kazu634/work/googlemaps/data.csv"</span>
<spanclass="synConstant"> -> INTO TABLE Shop FIELDS TERMINATED BY ","</span>
<spanclass="synConstant"> -> LINES TERMINATED BY "\n";</span>
<spanclass="synConstant">ERROR 29 (HY000): File '</span>/home/kazu634/work/googlemaps/data.csv<spanclass="synConstant">' not found (Errcode: 13)</span>
<spanclass="synConstant">mysql> LOAD DATA INFILE "/home/kazu634/work/googlemaps/data.csv"</span>
<spanclass="synConstant"> -> INTO TABLE Shop FIELDS TERMINATED BY ",";</span>
<spanclass="synConstant">ERROR 29 (HY000): File '</span>/home/kazu634/work/googlemaps/data.csv<spanclass="synConstant">' not found (Errcode: 13)</span>
</pre>
<h4>
そこで調べてみました
</h4>
<p>
どうやらカレントパス上のファイルを指定するためには、「LOAD DATA LOCAL INFILE」というように指定すればいいようです。すると、以下のようになって成功しました。
</p>
<preclass="syntax-highlight">
mysql> load data local infile <spanclass="synConstant">"data.csv"</span><spanclass="synSpecial">into</span><spanclass="synSpecial">table</span> Shop;
mysql> LOAD DATA LOCAL INFILE <spanclass="synConstant">"data.csv"</span><spanclass="synSpecial">INTO</span><spanclass="synSpecial">TABLE</span> Shop