Does anyone have experience with a VM running a MySQL database, and what happens during the backup procedure? Can the database be corrupted during the VM backup? How should one manage such an environment?
Hello,
you should use a hookscript that tells MySQL to flush the tables like mysql -e "FLUSH TABLES WITH READ LOCK;"
As Proxmox uses various phases during the backup you could issue this command in the backup-start phase and in post-restart you should call something like mysql -e "UNLOCK TABLES;"
The qemu-ga needs to be running in the vm to issue commands like that via hookscript: qm guest exec $VMID --timeout 300 -- mysql -e "FLUSH TABLES WITH READ LOCK;";
Depending on MySQL configuration you might need to add a user (-u <user>) which is allowed to execute these command to the databases.