mysql資料庫匯入匯出
阿新 • • 發佈:2019-02-04
一,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";
檢視相應的檔案在哪裡。