How to backup MySQL
Backup and Restore Capabilities
Most basic backup and restore capabilities are available for MySQL.
Backup Capabilities
Type of capability | Detailed information |
---|---|
What you can back up | Individual database groups. |
Types of backups that you can perform |
|
When you can perform backups |
|
Restore Capabilities
Type of capability | Detailed information |
---|---|
Time periods from which you can restore data |
|
Destinations that you can restore data to |
|
What Is Backed Up?
What Is Backed Up
MySQL system databases
MySQL user databases
MySQL databases (data and logs)
What Is Not Backed Up
You can use a file server to back up the following content, which is not included in backups of MySQL databases:
Operating system data
MySQL application files
MySQL Server information schema
MySQL Server performance schema
Requirements
Operating system requirements :
Operating System | Operating System Version | Architecture |
Linux | Debian |
|
| Debian 10.x | x64 or compatible processors |
| Debian 9.x | x64 or compatible processors |
| Red Hat Enterprise Linux/Oracle Linux Enterprise/CentOS |
|
| Red Hat Enterprise Linux/Oracle Linux Enterprise/CentOS 8.x | x86, x64 or compatible processors |
| Red Hat Enterprise Linux/Oracle Linux Enterprise/CentOS 7.x with glibc 2.17.x | x86, x64 or compatible processors |
| Red Hat Enterprise Linux/Oracle Linux Enterprise/CentOS 6.x with glibc 2.12.x | x86, x64 or compatible processors |
| SuSE Linux (SLES) |
|
| SuSE Linux 15.0 | x64 or compatible processors |
| SuSE Linux 12.0 | x64 or compatible processors |
| Ubuntu | x64 |
| Ubuntu 16.04 LTS | x64 or compatible processors |
| Ubuntu 14.04 LTS | x64 or compatible processors |
| Ubuntu 18.04 LTS | x64 or compatible processors |
Windows |
| |
| Windows 2016 |
|
| Microsoft Windows Server 2016 Editions | All Windows-compatible processors supported |
| Windows 2019 |
|
| Microsoft Windows Server 2019 Editions | All Windows-compatible processors supported |
For SE Linux implementation
If you have SELinux enabled on the client computer, create the SELinux policy module as a root user before performing a backup. The SELinux Development package must be installed on the client.
Please make sure binaries of Commvault are installed
Create the following files in the /usr/share/selinux/devel directory:
File Name | Content of the File |
<directory>/<file_name>.te where: <directory> is /usr/share/selinux/devel <file_name> is the name of the UNIX file, created to save the policy module statement. It is a good idea to use the same name for policy module and the file. For example: When you are creating a policy module for backup_IDA application, you can use the following file name: backup_IDA.te
| The content of the file should be as follows: policy_module(<name>,<version>) ############################## where: <name> is the name of the policy module. You can give any unique name to the policy module, such as a process or application name. <version> is the version of the policy module. It can be any number, such as 1.0.0. For Example: While creating a policy module for the backup_IDA application, you can use the following content. policy_module(backup_IDA,1.0.0) |
<directory>/<file_name>.fc where: <directory> is /usr/share/selinux/devel <file_name> is the name of the UNIX file, created to save the policy module statement. It is a good idea to use the same name for policy module and the file. For example: When you are creating a policy module for backup_IDA application, you can use the following file name: backup_IDA.fc
| The content of the file should be as follows: Note that the following list of files is not exhaustive. If the process fails to launch, check /var/log/messages. Also, if required, add it to the following list of files. /opt/<software installation directory>/Base/libCTreeWrapper.so -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libCVMAGuiImplgso -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libdb2locale.so.1 -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libdb2osse.so.1 -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libDb2Sbt.so -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libdb2trcapi.so.1 -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libDrDatabase.so -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libIndexing.so -- gen_context(system_u:object_r:texrel_shlib_t,s0) /opt/<software installation directory>/Base/libSnooper.so -- gen_context(system_u:object_r:texrel_shlib_t,s0)
|
2. Create the policy file from command line. Use the following command. Ensure that you give the following commands in the /usr/share/selinux/devel directory.
[root]# make backup_IDA.pp
Compiling targeted backup_IDA module
/usr/bin/checkmodule: loading policy configuration from tmp/backup_IDA.tmp
/usr/bin/checkmodule: policy configuration loaded
/usr/bin/checkmodule: writing binary representation (version 6) to tmp/backup_IDA.mod
Creating targeted backup_IDA.pp policy package
rm tmp/backup_IDA.mod tmp/backup_IDA.mod.fc
[root]# semodule -i backup_IDA.pp
3. Execute the policy module. Use the following command:
[root]# restorecon -R /opt/<software installation directory>
SELinux is now configured to work with this application.
Service account requirements
The MySQL agent requires a MySQL Server user account that has sufficient privileges for the software to:
Perform backups and restores
Access the MySQL Server application
Stop or start the MySQL Server services
The following table illustrates the necessary privileges the user account should have to perform backup and restore operations:
Operations | Privileges MySQL User Should Have | Example Query to Grant the Permission |
Backup |
| mysql> GRANT SHOW DATABASES, SUPER, RELOAD, SELECT, LOCK TABLES, PROCESS, EXECUTE, SHOW VIEW ON *.* to '<backup_agent_user>'@'localhost' IDENTIFIED BY '<backup_agent_password>'; It is recommended to grant all Database Administrator privileges to perform backup operations for some versions. Example: For MySQL 5.7 and later, you should grant all Database Administrator privileges to perform backup operations. mysql> GRANT ALL PRIVILEGES ON *.* TO '<backup_agent_user>'@'localhost' IDENTIFIED BY '<backup_agent_password>'; |
Restore | Full Database Administrator privileges | mysql> GRANT ALL PRIVILEGES ON *.* TO '<restore_agent_user>'@'localhost' IDENTIFIED BY '<restore_agent_password>'; |
Configuration requirements
Instance Name:
Binary directory:
Log data directory
Socket file:
Config file
OS User Name: operating system user name and password (the user should be a part of Local admin group)
Service account details: Username and Password