How to recover performance_schema after restoring from partial innobackupex backup?
-
29-09-2020 - |
Question
I am taking a partial backup from a Master server, which needs to be restored on a to-be slave server. I only need one of the databases, and the mysql database.
I am following instructions on https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/partial_backups_innobackupex.html
The command I'm using looks like this:
innobackupex --user=<the_user> --password --databases="<database_name> mysql" --slave-info /path/backup
The prepare command looks like this:
innobackupex --apply-log --export /path/backup
And then I
Copy back the prepared backup to a “clean” datadir (in that case, make sure to include the mysql database).
MySQL starts fine, but without a performance_schema and with a lot of
588 [ERROR] Native table 'performance_schema'.'' has the wrong structure
on its error log.
Any idea why this might happen, and how to get the performance_schema back?
Solution
The solution requires running mysql_upgrade on the server that has been restored. As per the documentation on https://dev.mysql.com/doc/refman/5.5/en/performance-schema-build-configuration.html
If you install MySQL over a previous installation that was configured without the Performance Schema (or with an older version of the Performance Schema that may not have all the current tables), run mysql_upgrade after starting the server to ensure that the performance_schema database exists with all current tables. Then restart the server.