[plug] moving MySQL

Craig Ringer craig at postnewspapers.com.au
Thu Aug 21 09:53:28 WST 2003


> Just did a quick little test, you can change the data directory by
> setting datadir=/path/to/my/data/dir in /etc/my.cnf
> This means that you can copy the old data directory to your new
> partition and then change the datadir, start up mysql again and you'll
> be running fine. (Note you need to keep the same permissions and user
> data)
> 
> If you dont have a my.cnf already then all you need is the following two
> lines:
> [mysqld]
> datadir=/path/to/my/data/dir

Another thing I've done, when I've either had a less obliging program or 
had to move a whole subtree to other storage, is use a bind mount.

If I was moving, say, /var/spool in it's entirety, I could just:

mount -t bind /var2/spool /var/spool

after, of course, a 'cp /var/spool /var2/spool && rm -rf /var/spool' to 
create /var2/spool and relocate the data.

Essentially, just mount one directory on another.

It's handy when you have fussy daemons that like to make sure /var etc 
aren't symlinks (wise enough, but occasionally annoying).

Craig Ringer



More information about the plug mailing list