Backup database with MySQL shell, alternative to mysqldump, mysqlsh

Dump all:
DBname="zabbix"
DBdumpath="/tmp"
util.dumpTables(DBname, [], DBdumpath + DBname, {"all": true,"threads": 4,"bytesPerChunk": "256M"});
restore schema:
util.loadDump(DBdumpath + DBname, {schema: "zabbix", "threads": 1, "loadData": false });
restore data, without history:
util.loadDump(DBdumpath + DBname, {schema: "zabbix", "threads": 1, "loadDdl": false, excludeTables:[DBname+".history",DBname+".history_str",DBname+".history_text",DBname+".uint",DBname+".log"]});
https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-utilities-dump-instance-schema.html

No comments: