关键配置:关闭binlog
环境:8G的sql文件,300多个InnoDB数据表,(用MysqlWorkbench导出的数据,用HeidiSql导入,因为正式环境是mysql,可以用MysqlWorkbench,而MariaDB用不了导出,要用HeidiSql,直接用mysqldump、source命令也可以)。导出耗时6分钟,导入耗时55分钟(有待提高,跟进中)
版本:MariaDB 10
1.注释“log-bin=mysql-bin”、“binlog_format=mixed”
2.“innodb_flush_log_at_trx_commit” 设置为“2”
3.导入完成后,一定要记得设置为原来的
附MysqlWorkbench生成的导出命令
18:24:07 Dumping XXXXXX (all tables)
Running: mysqldump.exe --defaults-extra-file="c:\users\admini~1\appdata\local\temp\2\tmpo4jjp3.cnf" --user=root --max_allowed_packet=1G --host=localhost --port=3306 --default-character-set=utf8 --routines "XXXXXX" 18:30:11 Export of D:\XXXXXX .sql has finished
附单表数据导入导出到CSV的命令
select * from XX表 into outfile 'c://XX表.csv' fields terminated by ',' optionally enclosed by '';
load data infile 'c://XX表.csv' into table XX表 fields terminated by ',' optionally enclosed by '';