IT reseller takeaway: Virtualizing your customers' database instances allows you to offer them extra data backup...
and protection, bringing them peace-of-mind during a migration, repair or server crash. This tip excerpt from our sister site SearchServerVirtualization.com will get you started.
Virtualizing your database instances is one of the pleasures of running virtual machines (VMs). Here are a few situations and resolutions that I have had to deal with in the past few months, and the nitty-gritty of how I escaped database pain.
MySQL database move
Recently, I had to migrate a database from one VM to another, while neither taking down or restarting either VM or running MySQL instance. Normally, this can be accomplished with some form of:
mysqldump databasename >filetodumpto.sql mysql -u user -ppassword databasename < filetodumpto.sql
Exporting and then importing works when trying to move data, but when you introduce binary blobs and GBs of data, it becomes much more time-consuming.
Thankfully, there is an all-powerful program that every MySQL wannabe should have in their technical repertoire: mysqlcheck. When migrating database servers, recovering from a mysql server crash, repairing corrupt databases/tables, or other unexpected database/table catastrophes occur, the 'mysqlcheck' program comes to the rescue.
Here's a fairly standard workflow:
scp -r /var/lib/mysql/dbname server:/var/lib/mysql/ chown -R mysql:mysql /var/lib/dbname mysqlcheck -h localhost -u user -r -p -B dbname
The mysqlcheck program often helps when you are powering off (accidentally or otherwise) VMs and you corrupt your mysql instances/table/etc.Read the entire article.