# FAQ

Common errors and fixes for MySQL and MariaDB backup operations.

Most MySQL backup failures fall into two categories: permission issues that prevent `mysqldump` from acquiring the locks it needs, and connection timeouts caused by large tables or slow queries. The entries below cover the most common cases and how to resolve them.

## Backups fail after upgrading to MySQL 5.7.41 or 8.0.32

MySQL versions 5.7.41+ and 8.0.32+ require additional privileges for `mysqldump` to execute `FLUSH TABLES`. If your backups were working before a recent MySQL upgrade and are now failing, grant the required permissions to your backup user:

```sql
GRANT RELOAD, PROCESS ON *.* TO 'backup_user'@'%';
FLUSH PRIVILEGES;
```

Replace `backup_user` with the actual user SimpleBackups uses to connect to your database.

If granting permissions does not resolve the issue and you are using your own server, you can pin `mysqldump` to an earlier version (8.0.30) to work around the bug:

```bash
sudo apt-get install libncurses5
mkdir -p /opt/mysql && cd /opt/mysql
curl https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.30-linux-glibc2.17-x86_64-minimal.tar.xz | tar -xvJ
mv mysql-8.0.30-linux-glibc2.17-x86_64-minimal 8.0.30
sudo ln -s /opt/mysql/8.0.30/bin/mysqldump /usr/local/bin/mysqldump
```

## Couldn't execute 'FLUSH TABLES WITH READ LOCK'

The error `Couldn't execute 'FLUSH TABLES WITH READ LOCK': Access denied` means your backup user lacks the `RELOAD` privilege. This privilege is required for `mysqldump` to acquire a consistent snapshot of MyISAM tables. Grant it with:

```sql
GRANT RELOAD ON *.* TO 'backup_user'@'%';
FLUSH PRIVILEGES;
```

For InnoDB-only databases, you can avoid the lock entirely by adding `--single-transaction` to your **Custom Dump Flags** in the backup settings.

## mysqldump: Couldn't execute 'show create table'

The error `Couldn't execute 'show create table table_name': Table is marked as crashed` means a table is corrupted. Repair it with `mysqlcheck` before retrying the backup:

```bash
mysqlcheck -u username -p --repair database_name
```

To repair a specific table only:

```bash
mysqlcheck -u username -p --repair database_name table_name
```

If you have phpMyAdmin access, you can also repair via **Operations → Table maintenance → Repair table**. After the repair, re-run the backup to confirm it succeeds.

## Error 2013: Lost connection during dump

The error `Error 2013: Lost connection to MySQL server during query when dumping table` occurs when a query takes longer than the `net_read_timeout` or `net_write_timeout` value. This is common with large tables.

Check your current timeout values:

```sql
SHOW VARIABLES LIKE 'net%timeout%';
```

Increase both to 900 seconds:

```sql
SET GLOBAL net_read_timeout = 900;
SET GLOBAL net_write_timeout = 900;
```

These values reset when MySQL restarts. To make them permanent, add them to your MySQL configuration file under `[mysqld]`:

```plain
[mysqld]
net_read_timeout = 900
net_write_timeout = 900
```
