The mysqlbackup command connects to the MySQL
server using the credentials supplied with the
--user and --password options.
The specified user needs certain
privileges. You can either create a new user with a limited set
of privileges, or use an administrative account such as root.
Here are the privileges required by
mysqlbackup:
The minimum privileges for the MySQL user with which mysqlbackup connects to the server include:
SELECTon all databases and tables, for table locks that protect the backups against inconsistency caused by parallel DDL operations.BACKUP_ADMINon all databases and tables.RELOADon all databases and tables.SUPER, to enable and disable logging, and to optimize locking in order to minimize disruption to database processing.REPLICATION CLIENT, to retrieve the binary log position, which is stored with the backup.PROCESS, to process DDL statements with theALGORITHM = INPLACEclause.CREATE,INSERT,DROP, andUPDATEon the tablesmysql.backup_progressandmysql.backup_history, and alsoSELECTandALTERonmysql.backup_history.
To create a MySQL user (
mysqlbackupin this example) and set the above-mentioned privileges for the user to connect from localhost, issue statements like the following from themysqlclient program:CREATE USER 'mysqlbackup'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT, BACKUP_ADMIN, RELOAD, PROCESS, SUPER, REPLICATION CLIENT ON *.* TO `mysqlbackup`@`localhost`; GRANT CREATE, INSERT, DROP, UPDATE ON mysql.backup_progress TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP, UPDATE, SELECT, ALTER ON mysql.backup_history TO 'mysqlbackup'@'localhost';The following additional privileges are required for using specific features of MySQL Enterprise Backup:
For using transportable tablespaces (TTS) to back up and restore InnoDB tables:
LOCK TABLESfor backing up tables.CREATEfor restoring tables.DROPfor dropping tables if the restore fails for some reasons.FILEfor restoring tables in external tablespaces outside of the server's data directory.
For creating tape backups using the System Backup to Tape (SBT) API :
CREATE,INSERT,DROP, andUPDATEon themysql.backup_sbt_historytable
For working with encrypted InnoDB tables:
ENCRYPTION_KEY_ADMINto enable InnoDB encryption key rotation.
For backing up and restoring user-created non-InnoDB tables:
LOCK TABLESon all schemas containing user-created non-InnoDB tables
For using redo log archiving for backups:
to invoke theINNODB_REDO_LOG_ARCHIVEfunction .innodb_redo_log_archive_start()
For Section 5.1.4, “Table-Level Recovery (TLR)” of non-TTS backups:
INSERTandALTERto update tables
Set those additional privileges if you are using the features that require them. To set all of them, issue statements like the following from the
mysqlclient program:GRANT LOCK TABLES, CREATE, DROP, FILE, INSERT, ALTER ON *.* TO 'mysqlbackup'@'localhost'; GRANT CREATE, DROP, UPDATE ON mysql.backup_sbt_history TO 'mysqlbackup'@'localhost'; GRANT ENCRYPTION_KEY_ADMIN ON *.* TO 'mysqlbackup'@'localhost'; GRANT INNODB_REDO_LOG_ARCHIVE ON *.* TO 'mysqlbackup'@'localhost';For privileges required for using MySQL Enterprise Backup with a Group Replication setting, see Chapter 9, Using MySQL Enterprise Backup with Group Replication.
The following additional privileges might also be required after a server upgrade:
When using MySQL Enterprise Backup 8.4 for the first time on a MySQL Server that has been upgraded from 8.0.18 or earlier and has been backed up by MySQL Enterprise Backup before:
ALTERonmysql.backup_progress.CREATE,INSERT, andDROPonmysql.backup_progress_old.CREATE,INSERT,DROP, andALTERonmysql.backup_progress_new.
Grant these privileges by issuing these sample statements at the mysql client:
GRANT ALTER ON mysql.backup_progress TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP ON mysql.backup_progress_old TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP, ALTER ON mysql.backup_progress_new TO 'mysqlbackup'@'localhost';NoteIf you are working with a multiprimary Group Replication setting, make sure these privileges are granted on all primary nodes; see also Chapter 9, Using MySQL Enterprise Backup with Group Replication.
These privileges are for the attempt to migrate the
mysql.backup_progresstable to a newer format (see Appendix F, Backup Progress Table Update for details), and they are no longer needed after the first backup operation by MySQL Enterprise Backup 8.4 has taken place on the server, by which point they can be revoked.When using MySQL Enterprise Backup 8.4 for the first time on a MySQL Server that has been upgraded from 8.0.11 or earlier and has been backed up by MySQL Enterprise Backup before:
CREATE,INSERT, andDROPonmysql.backup_history_old.CREATE,INSERT,DROP, andALTERonmysql.backup_history_new.
Grant these privileges by issuing these sample statements at the mysql client:
GRANT CREATE, INSERT, DROP ON mysql.backup_history_old TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP, ALTER ON mysql.backup_history_new TO 'mysqlbackup'@'localhost';NoteIf you are working with a multiprimary Group Replication setting, make sure these privileges are granted on all primary nodes; see also Chapter 9, Using MySQL Enterprise Backup with Group Replication.
These privileges are for the attempt to migrate the
mysql.backup_historytable to a newer format (see Appendix D, Backup History Table Update for details), and they are no longer needed after the first backup operation by MySQL Enterprise Backup 8.4 has taken place on the server, by which point they can be revoked.When performing for the first time a backup using the SBT API with MySQL Enterprise Backup 8.4 on a MySQL Server that has been upgraded from 8.0.20 or earlier and has been backed up by MySQL Enterprise Backup before using the SBT API:
ALTERonmysql.backup_sbt_history.CREATE,INSERT, andDROPonmysql.backup_sbt_history_old.CREATE,INSERT,DROP, andALTERonmysql.backup_sbt_history_new.
Grant these privileges by issuing these sample statements at the mysql client:
GRANT ALTER ON mysql.backup_sbt_history TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP ON mysql.backup_sbt_history_old TO 'mysqlbackup'@'localhost'; GRANT CREATE, INSERT, DROP, ALTER ON mysql.backup_sbt_history_new TO 'mysqlbackup'@'localhost';NoteIf you are working with a multiprimary Group Replication setting, make sure these privileges are granted on all primary nodes; see also Chapter 9, Using MySQL Enterprise Backup with Group Replication.
These privileges are for the attempt to migrate the
mysql.backup_sbt_historytable to a newer format (see Appendix E, SBT Backup History Table Update for details), and they are no longer needed after the first backup operation by MySQL Enterprise Backup 8.4 using the SBT API has taken place on the server, by which point they can be revoked.
Make sure that the limit
MAX_QUERIES_PER_HOUR is not set for the
user mysqlbackup uses to access the server,
or backup operations might fail unexpectedly.