Hi Maurice,
The sys schema is a collection of views, stored procedures, stored functions, a single table with triggers. These objects are meant to make it easier to use the Performance Schema as well as providing some other utilities and views.
You can read more about the sys schema in
https://dev.mysql.com/doc/refman/5.7/en/sys-schema.html
In order to back it up with mysqldump, the user must have access to the objects. For views this includes the user must be able to access the underlying functions and tables used by the view.
Assuming you have SELECT on all tables (globally), the privileges you need in order to back up the sys schema are:
+-------------------------------------------------------------------------------------------+
| Grants for testuser@localhost |
+-------------------------------------------------------------------------------------------+
| GRANT SELECT ON *.* TO 'testuser'@'localhost' |
| GRANT LOCK TABLES, SHOW VIEW ON `sys`.* TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`extract_table_from_file_name` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`format_path` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`format_statement` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`extract_schema_from_file_name` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`ps_thread_account` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`format_time` TO 'testuser'@'localhost' |
| GRANT EXECUTE ON FUNCTION `sys`.`format_bytes` TO 'testuser'@'localhost' |
+-------------------------------------------------------------------------------------------+
9 rows in set (0.00 sec)
The functions that the user must have EXECUTE on are helper and formatting functions used by the views. As the views use several Performance Schema tables, you also need SELECT on those.
Hope that helps.
Best regards,
Jesper Krogh