Date: Fri, 3 Sep 2004 15:02:15 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Bart Silverstrim <bsilver@chrononomicon.com> Cc: freebsd-questions@freebsd.org Subject: Re: Moving MySQL database Message-ID: <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com> References: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Fri, Sep 03, 2004 at 09:42:36AM -0400, Bart Silverstrim wrote:
> I have a server that is rapidly filling the var partition with a MySQL
> database. I'd like to move it to a subdirectory somewhere under /usr.
>
> Is there a document that would outline a "best practices" approach to
> doing this? My first instinct was to stop the mysqld, do a mv on
> /var/db to /var/db2 to rename it, copy the data to a /usr/local/db
> folder and alter permissions on it to match /var/db, then make a
> softlink between /usr/local/db and /var/db and restart mysqld so mysqld
> wouldn't need any reconfiguring and everything, I would *think*, should
> keep working...only now it will be working off a far more spacious
> partition.
I'd do it this way:
i) Stop mysql
ii) Remove (pkg_delete) the mysql-server package
iii) Move the database files to their new location, taking care to
preserve ownership, permissions, timestamps etc.
iv) Reinstall the mysql-server port setting a different DB_DIR on
the make command line:
# make DB_DIR=/usr/local/db install
v) Make sure that the home directory of the mysql user account is
the same as you set DB_DIR to. The port should take care of
that, but it won't hurt to double check.
% grep mysql /etc/passwd
mysql:*:88:88:MySQL Daemon:/usr/local/db:/sbin/nologin
vi) Restart the mysql server. Verify that your data survived the
move.
And that's it: you're done.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
iD8DBQFBOHlniD657aJF7eIRAmpSAJ9pdyzNPf5woMX1ECNpZodFJYkWXQCgjGki
QsO8HdaXY9Dn9iXgnTXipXM=
=Z9RO
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040903140215.GB23032>
