Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
multiple file systems for mysql


How can I put mysql databases in different partition (linux - Ubuntu)?

Thanks, yosef

share|improve this question

marked as duplicate by Chopper3 Mar 21 '11 at 0:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Create the new partition and filesystem. Mount it somewhere. Stop mysql and copy the entire contents of /var/lib/mysql to the new location. Be sure to preserve permissions and ownership.

You now have a few options (all assuming you mounted the new filesystem in /opt/mysql_data:

  1. Delete /var/lib/mysql and create a symlink from it to the new directory. For example:

    ln -s /opt/mysql_data /var/lib/mysql
  2. Create a file in /etc/mysql/conf.d called "local_configs.cnf" and put the following lines in that file:

  3. After the data is copied, mount the new filesystem directly on /var/lib/mysql.

Whichever path you take, when you start mysql back up again it will be using the new location.

share|improve this answer

See multiple file systems for mysql

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Mark Henderson Sep 25 '12 at 4:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.