Virtualized MySQL: Troubleshooting

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/

    Requires Free Membership to View

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.

This was first published in September 2007

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.