From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 15:41:00 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 0F65016A4D1 for ; Fri, 3 Sep 2004 15:41:00 +0000 (GMT) Received: from lorna.circlesquared.com (host217-45-219-85.in-addr.btopenworld.com [217.45.219.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7FD643D54 for ; Fri, 3 Sep 2004 15:40:54 +0000 (GMT) (envelope-from peter@circlesquared.com) Received: from circlesquared.com (localhost.circlesquared.com [127.0.0.1]) i83Fe49v014255; Fri, 3 Sep 2004 16:40:04 +0100 (BST) (envelope-from peter@circlesquared.com) Message-ID: <41389054.90304@circlesquared.com> Date: Fri, 03 Sep 2004 16:40:04 +0100 From: Peter Risdon User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040611 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Seaman References: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com> <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org cc: Bart Silverstrim 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 15:41:00 -0000 Matthew Seaman wrote: > 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. Might a cp -p be slightly more cautious/paranoid until step vi has been completed? Peter. > > 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 >