# Backup and mysql upgrade

**URL:** <https://forums.percona.com/t/backup-and-mysql-upgrade/31657>\
**Category:** Percona XtraBackup\
**Created:** [July 17, 2024, 12:29pm UTC](https://forums.percona.com/t/backup-and-mysql-upgrade/31657 "2024-07-17T12:29:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clark](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@Clark](https://forums.percona.com/u/Clark)\
**Post date:** [July 17, 2024, 12:29pm UTC](https://forums.percona.com/t/backup-and-mysql-upgrade/31657/1 "2024-07-17T12:29:33Z")

</div>

When upgrading mysql 8 and the mysql data dir is a restore from xtrabackup I’m running into some issues

After upgrading mysql the error log looks like this

```auto
2024-07-17T11:32:26.071558Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.38) starting as process 1245402
2024-07-17T11:32:26.090694Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-17T11:32:27.215687Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-17T11:32:27.356228Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 1, name 'sys/sys_config', file './sys/sys_config.ibd' is missing!
2024-07-17T11:32:28.020449Z 4 [System] [MY-013381] [Server] Server upgrade from '80036' to '80038' started.
2024-07-17T11:32:44.563061Z 4 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.
2024-07-17T11:32:44.563232Z 4 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.
2024-07-17T11:32:44.563267Z 4 [ERROR] [MY-012216] [InnoDB] Cannot open datafile for read-only: './sys/sys_config.ibd' OS error: 71
2024-07-17T11:32:44.563517Z 4 [Warning] [MY-012049] [InnoDB] Cannot calculate statistics for table `sys`.`sys_config` because the .ibd file is missing. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting.html for how to resolve the issue.
2024-07-17T11:32:44.563768Z 4 [ERROR] [MY-013178] [Server] Execution of server-side SQL statement '-- Copyright (c) 2014, 2024, Oracle and/or its affiliates. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; version 2 of the License. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -- -- Table: sys_config -- -- Stores configuration options for sys objects -- CREATE TABLE IF NOT EXISTS sys_config ( variable VARCHAR(128) PRIMARY KEY, value VARCHAR(128), set_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, set_by VARCHAR(128) ) ENGINE = InnoDB; ' failed with error code = 1812, error message = 'Tablespace is missing for table `sys`.`sys_config`.'.
2024-07-17T11:32:44.574825Z 0 [ERROR] [MY-013380] [Server] Failed to upgrade server.
2024-07-17T11:32:44.574906Z 0 [ERROR] [MY-010119] [Server] Aborting

```

The way I created the backup file was like this, where I didn’t include the `sys` folder

```auto
xtrabackup --backup --user=root --password=xxx --databases="mydb mysql" --stream=xbstream --compress --target-dir=./ 2> backup.log 1> backup.xbstream

```

I guess I should include both `performance_schema` and `sys` like this?

```auto
xtrabackup --backup --user=root --password=xxx --databases="mydb mysql performance_schema sys" --stream=xbstream --compress --target-dir=./ 2> backup.log 1> backup.xbstream

```

Or is it even necessary to add `performance_schema` to the backup?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [July 17, 2024, 1:08pm UTC](https://forums.percona.com/t/backup-and-mysql-upgrade/31657/2 "2024-07-17T13:08:41Z")

</div>

Upgrading within MySQL 8, you need to backup/restore all databases. MySQL 8 is _very_ sensitive/has issues with tablespaces. I recommend removing the `--databases` flag altogether and do a full backup/restore.
