From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 14:02:31 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0346116A4CE for ; Fri, 3 Sep 2004 14:02:31 +0000 (GMT) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FFEE43D49 for ; Fri, 3 Sep 2004 14:02:30 +0000 (GMT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) i83E2FYG077616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Sep 2004 15:02:15 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)i83E2Fvd077615; Fri, 3 Sep 2004 15:02:15 +0100 (BST) (envelope-from matthew) Date: Fri, 3 Sep 2004 15:02:15 +0100 From: Matthew Seaman To: Bart Silverstrim Message-ID: <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Bart Silverstrim , freebsd-questions@freebsd.org References: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KFztAG8eRSV9hGtP" Content-Disposition: inline In-Reply-To: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com> User-Agent: Mutt/1.4.2.1i X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.6 (smtp.infracaninophile.co.uk [IPv6:::1]); Fri, 03 Sep 2004 15:02:15 +0100 (BST) X-Virus-Scanned: clamd / ClamAV version devel-20040705, clamav-milter version 0.74a on smtp.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.64 X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on happy-idiot-talk.infracaninophile.co.uk cc: freebsd-questions@freebsd.org Subject: Re: Moving MySQL database X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2004 14:02:31 -0000 --KFztAG8eRSV9hGtP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=20 > database. I'd like to move it to a subdirectory somewhere under /usr. >=20 > Is there a document that would outline a "best practices" approach to=20 > doing this? My first instinct was to stop the mysqld, do a mv on=20 > /var/db to /var/db2 to rename it, copy the data to a /usr/local/db=20 > folder and alter permissions on it to match /var/db, then make a=20 > softlink between /usr/local/db and /var/db and restart mysqld so mysqld= =20 > wouldn't need any reconfiguring and everything, I would *think*, should= =20 > keep working...only now it will be working off a far more spacious=20 > 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=3D/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 =20 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 --=20 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 --KFztAG8eRSV9hGtP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBOHlniD657aJF7eIRAmpSAJ9pdyzNPf5woMX1ECNpZodFJYkWXQCgjGki QsO8HdaXY9Dn9iXgnTXipXM= =Z9RO -----END PGP SIGNATURE----- --KFztAG8eRSV9hGtP--