一,CSV格式
采用csv格式导入导出mysql中的数据都会非常快,经过测试,通过csv格式导入1566w的数据只需要花了112mins。
- 1,导出csv格式
into outfile '/tmp/test.csv'
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
- 2,导入csv格式
load data infile '/tmp/test.csv'
into table test_info
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
- 3,错误处理。
ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
通过命令:
SHOW VARIABLES LIKE "secure_file_priv";
查看相应的文件在哪里。