首页 > 代码库 > Modify MySQL dump file the fatest way

Modify MySQL dump file the fatest way

使用mysql命令导入mysqldump生成的sql文件时,为了提高导入速度,往往需要修改dump文件,但是面对一个几十GB的文件,这事儿就太崩溃了,最快速的方法是这么做:

(    echo "SET AUTOCOMMIT=0;"    echo "SET UNIQUE_CHECKS=0;"    echo "SET FOREIGN_KEY_CHECKS=0;"    cat cc_jiecao.sql    echo "SET FOREIGN_KEY_CHECKS=1;"    echo "SET UNIQUE_CHECKS=1;"    echo "SET AUTOCOMMIT=1;"    echo "COMMIT;") | mysql -u... -p... target_database

Reference:smarter-faster-backups-restores-mysql-databases-with-mysqldump

原文链接: http://onlyvc.us/modify-mysql-dump-file-the-fatest-way/

Modify MySQL dump file the fatest way