Re: Move MySQL data directories
- From: Lars Eighner <usenet@xxxxxxxxxxxxxxx>
- Date: Fri, 16 Jan 2009 16:28:14 +0000 (UTC)
In our last episode,
<b91c385b-ebc2-4927-b473-777b0f5f622a@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, the
lovely and talented David broadcast on comp.unix.bsd.freebsd.misc:
Hi all,
Im new to the FreeBSD arena. I moved to a FreeBSD server to run mysql,
so far its run great compared to several issues with Linux (No attack
linux is also very good, it just caused more issues for this purpose
than FreeBSD). My only problem is that it now has to be running 24x7
most of the time. I only noticed afterwards the automatic partitioning
did not give enough space for the MySQL server its primary purpose it
is to serve - it set the majority to a /usr partition.
I need to move all the files and directories from /var/db/mysql to a
path under /usr.
Could anyone confirm cp using the --preserve argument would be the
correct way to preserve all files and security descriptors, during the
move. I assume after this I could use a symbolic link to the new
location from the existing path /var/db/mysql.
(I could not find disk re-partitioning tools for UFS, and re-
formatting seems too extreme if it can be done like above, 1 point for
Linux - plenty I found exist for ext / reiser / etc, -1 for annoying
problems when attempting to get stability of FreeBSD for this
purpose). (Am trying not to start a OS fight here).
Any suggestions / advise.
I am not sure how to do this with a live system. The daemon controler
is mysqld_safe, so you might have to research it if you have users who might
be accessing the database while you are trying to move it. But if this is
just your desktop and you do not mind rebooting, it is absurdly simple.
Boot to single-user. Simply copy the mysgl directory to where you want it.
I keep a data directory for easy backup of many kinds of data, so I created
/usr/local/data and copied the mysql directory to /usr/local/data/mysql .
Edit /etc/rc.conf, so that it contains
mysql_data_dir="/usr/local/data/mysql"
or wherever you put it.
Reboot.
The actual start-up script is in /usr/local/etc/rc.d but you should not have
to mess with it. Make changes to the configuration in /etc/rc.conf, but
other than pointing it to the data directory you want to use, you shouldn't
have to do anything.
--
Lars Eighner SAVE BEASTIE! "What do you do when you're debranded?"
usenet@xxxxxxxxxxxxxxx http://larseighner.com/
TIP: if mplayer (gmplayer) complains it can't find subfont.ttf and acts up -
ln -s /usr/X11R6/lib/X11/fonts/bitstream-vera/VeraMono.ttf .mplayer/subfont.ttf
.
- Follow-Ups:
- Re: Move MySQL data directories
- From: Lars Eighner
- Re: Move MySQL data directories
- References:
- Move MySQL data directories
- From: David
- Move MySQL data directories
- Prev by Date: Move MySQL data directories
- Next by Date: Re: Move MySQL data directories
- Previous by thread: Move MySQL data directories
- Next by thread: Re: Move MySQL data directories
- Index(es):
Relevant Pages
|