MySQL Shell 8.x

MySQL Shell – Create and Restore a MySQL backup

MySQL Shell is an advanced client and code editor for MySQL. In addition to the SQL functionality, similar to mysql client, MySQL Shell provides scripting capabilities for JavaScript and Python. It also includes APIs for working with MySQL.

  • X DevAPI: enables you to work with both relational and document data.
  • AdminAPI: enables you to work with InnoDB Cluster, see Chapter 6, Using MySQL AdminAPI.

MySQL Shell 8.x is highly recommended for use with MySQL Server 8.0 and 5.7. Download site is at https://dev.mysql.com/downloads/shell/.

MySQL Shell provides new utilities to create and restore a logical dump/backup for the entire database instance, including MySQL users. These utilities are listed below:

NameDescription
util.dumpInstance()Dump an entire database instance, including users.
util.dumpSchemas()Dump a set of schemas.
util.loadDump()A dump loading utility that can import schemas dumped using dumpInstance() utility and dumpSchemas() utility.
util.dumpTables()Dump specific tables and views.

Examples

Recently I was working on a project where I used MySQL Shell’s dumpSchemas() utility. Commands I used to create the dump were:

By default util.dumpSchemas() will use chunking to speed up the dump creation. Unfortunately I hit the following error while backup was being taken although the dry run did not warn me of any issues.

Fix was to use chunking:false option:

I haven’t seen any bug report for this yet, but it does look like one and I am sure it will be fixed in the upcoming releases of MySQL Shell. I have had a chance to speak to Oracle MySQL Development team to let them know of this issue.

Menu