TurnKey Linux Virtual Appliance Library

MYSQL On LAMP Appliance - Moving the data files

Can someone point my to a quick tutorial on the proper way to move the MYSQL data files. I want to move them to my elastic storage connected drive. I've followed a couple of step by step tutorials I found online googling "move mysql datafiles," but they don't seem to work. I'm looking for something specific to this appliance. 2. How do I turn on error logging in the mysql startup script. Thanks! Chris
Liraz Siri's picture

Write an ebsmount hook

I think you can use an ebsmount hook to do what you want. ebsmount hooks are scripts that are automatically run when you attach and EBS volume. Try something like this:

#!/bin/bash

/etc/init.d/mysql stop
mount --bind /media/ebs/.../mysql /var/lib/mysql
/etc/init.d/mysql start

Now after you connect your EBS volume /var/lib/mysql is really that directory inside your EBS volume as far as the operating system concerned.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)