在 infobright 提示符下运行时,查询执行得非常好:
mysql> LOAD DATA INFILE '/tmp/test.agg' IGNORE INTO TABLE tb_message_content FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\'LINES TERMINATED BY '\n';
Query OK, 2 rows affected
但是,从 shell 脚本运行时,相同的查询会出错:这就是脚本解释查询的方式
mysql -u amr_ts_scripts -pamr_ts_scripts MVR4_ETL_DB -S /tmp/mysql-ib.sock -N -e
$'LOAD DATA INFILE \'/tmp/test.agg\'
IGNORE INTO TABLE tb_message_content \n
FIELDS TERMINATED BY \',\' \n
OPTIONALLY ENCLOSED BY \'"\' \n
ESCAPED BY \'\\\'\n
LINES TERMINATED BY \'\\n\';'
引用的错误是:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\'
LINES TERMINATED BY ''' at line 4
PAGER set to stdout
谁能指出我面临的问题?