# Relocate MySQL DB dir to "/home/mysql"... Okay to do that?

**URL:** <https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740>\
**Category:** Virtualmin\
**Created:** [October 26, 2010, 10:04pm UTC](https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740 "2010-10-26T22:04:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Locutus](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/l/90ced4/32.png) [@Locutus](https://forum.virtualmin.com/u/Locutus)\
**Post date:** [October 26, 2010, 10:04pm UTC](https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740/1 "2010-10-26T22:04:03Z")

</div>

Hellos!

For purposes of some protection against HDD failure, I intend to put “/home” on a RAID-1. In addition to the server owner homes, I’d like to have the MySQL database directory there.

So (after stopping the server) I moved the contents of /var/lib/mysql to /home/mysql, gave that directory the proper owner and permissions, added access to it to /etc/apparmor.d and changed the path in MySQL’s config file.

Server seems to run fine with that change. Would there be any further caveats here concerning Virtualmin? Or does it not care where MySQL’s data directory is? 🙂 (I suppose for backup purposes, it will use SQL dumps anyway, and not copy away the data directory contents.)

---

<div class="post-metadata">

**Author:** ![Eric](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@Eric](https://forum.virtualmin.com/u/Eric)\
**Post date:** [October 27, 2010, 12:28am UTC](https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740/2 "2010-10-27T00:28:59Z")

</div>

Howdy,

I suspect that, for the most part, Virtualmin doesn’t care too much about where you put that.

Virtualmin does attempt to set the group permission on the database file to match the Virtual Server owner… but it should be able to find that based on the data directory setting in your MySQL config. You can verify that Virtualmin sees the correct data dir by taking a peek at Webmin -\> Servers -\> MySQL Database Server -\> MySQL Server Configuration, and look at “Databases files directory”.

-Eric

---

<div class="post-metadata">

**Author:** ![Locutus](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/l/90ced4/32.png) [@Locutus](https://forum.virtualmin.com/u/Locutus)\
**Post date:** [October 27, 2010, 8:41am UTC](https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740/3 "2010-10-27T08:41:15Z")

</div>

Thanks for your reply Eric!

Creating the DB during domain creation seems to be working fine. I already had found that setting in the Webmin MySQL module, which was explicitly set to /var/log/mysql, and changed it accordingly.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [April 30, 2020, 5:50am UTC](https://forum.virtualmin.com/t/relocate-mysql-db-dir-to-home-mysql-okay-to-do-that/37740/4 "2020-04-30T05:50:14Z")

</div>

Closed on April 30, 2020, 5:50am UTC


