既然找到我,就说明你通过程序也束手无策了,首先你遇到的问题,数据量过大,脚本跑不动了
我的操作流程:
一、mongodb,通过工具把数据导出到csv中,估计你查找大部分文章都是这个逻辑,这个很容易用你常用的工具,都可以实现
二、怎么导入到mysql:
执行语句:load data infile '/usr/local/mysql/implode/load.csv' into table 表名 fields terminated by ',' optionally enclosed by '"' lines terminated by '\r\n'
问题1:ERROR 1290 (HY0)00: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
怎么办?修改my.cnf,添加一个参数【secure_file_priv = /usr/local/xxx/xxx】
问题2:是不是发现字段不匹配要执定行?
正确语句:load data infile '/usr/local/mysql/implode/load.csv' into table 表名 fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' ignore 1 lines (_id,reply_id,answer_id,question_id,add_ts,questionnaire_school_id,user_id);
注意:指定列不是在table后面,而是最后面指定
问题3:ERROR 1262 (01000): Row 1 was truncated; it contained more data than there were input columns
解决办法:set sql_mode='no_auto_create_user,no_engine_substitution';