Re: Move MySQL data directories



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
.



Relevant Pages

  • Re: Ask a question
    ... does a great job of fulfilling it first purpose: education. ... that Linux or BSD had, ... Today, I use MINIX3 exclusively for my flavor of UNIX, on a virtual PC ...
    (comp.os.minix)
  • Re: Ask a question
    ... does a great job of fulfilling it first purpose: education. ... When asked if Minix3 had the support and popularity ... that Linux or BSD had, ...
    (comp.os.minix)
  • Re: Which webcam for Linux to do realtime image processing?
    ... under Linux, for realtime image processing as a hobbyist, for various ... purpose like tracking objects or objects recognition. ... In fact, buying one which work under Linux is not a problem, but I asked ...
    (sci.image.processing)
  • Re: A Parable of Two Carpenters
    ... Hope Linux isn't quite so bad. ... Its good NOT to have a purpose in life. ... >> have to port the API calls for the drawing code. ...
    (alt.lang.asm)
  • Re: spring by ananasmurska )asm 02)
    ... spring (no extension) ... is it linux ... Ananasmurska later released a final which also includes a windows version, but the info on pouet.net was incorrect. ...
    (comp.sys.ibm.pc.demos)