Why are tables in the `mysql` schema not restored?

Starting from BR v5.1.0, when you perform a full backup, BR backs up the tables in the mysql schema. Before BR v6.2.0, under default configuration, BR only restores user data, but does not restore tables in the mysql schema.

To restore a table created by the user in the mysql schema (not system tables), you can explicitly include the table using table filters. The following example shows how to restore the mysql.usertable table when BR performs a normal restore.

br restore full -f '*.*' -f '!mysql.*' -f 'mysql.usertable' -s $external_storage_url --with-sys-table

In the preceding command,

  • -f '*.*' is used to override the default rules
  • -f '!mysql.*' instructs BR not to restore tables in mysql unless otherwise stated.
  • -f 'mysql.usertable' indicates that mysql.usertable should be restored.

If you only need to restore mysql.usertable, run the following command:

br restore full -f 'mysql.usertable' -s $external_storage_url --with-sys-table

Note that even if you configures table filter, BR does not restore the following system tables:

  • Statistics tables (mysql.stat_*)
  • System variable tables (mysql.tidb, mysql.global_variables)
  • Other system tables