Safe to move mysql datadir to /var/lib/mysql ?

ArgonX

New member
Joined
Jun 21, 2011
Messages
2
Normal installations of mysql have their datadir in /var/lib/mysql and i have partition mounted here with noatime. So it's safe to change the datadir without breaking any scripts and such ?
 
If you are a directadmin user the datadir should be in /home/mysql not where you wrote.

This is a forum specific for hosting using DirectAdmin control panel.

Sayd that, i dunno about your question, maybe someone will have a better reply, but, my suggestion is keep trying with google or a more specific forum.

Regards
 
If I recall correctly, MySQL databases are stored in a directory determined by the OS distribution. For example, I use CentOS, and my databases are already stored in /var/lib/mysql. I don't know where DirectAdmin keeps it's scripts/references to control MySQL databases, so I'm not sure if you can move them or not.

Perhaps someone else, who knows, will reply.

Jeff
 
Hello,

FreeBSD/Debian:
/home/mysql

Fedora/Redhat/CentOS:
/var/lib/mysql


As for the inital question, yes, you can move it around.

This guide is backwards to what you've got, but is the same basic idea:
/var/lib/mysql -> /home/mysql
http://help.directadmin.com/item.php?id=12



But, instead of linking /home/mysql to your new location (which would be a double link), just change:
/usr/local/mysql/data

to point to your new location, as it's a link by default, so you need only point it to your new location.

Make sure mysqld is fully stopped before moving the data around.
Stop mysqld from:
Admin Level -> Services Monitor

so that the services.status has mysqld=OFF, so that the dataskq doesn't start it up on you.

John
 
Back
Top