From owner-freebsd-questions@FreeBSD.ORG Fri Sep 3 14:09:42 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 45B6E16A4CE for ; Fri, 3 Sep 2004 14:09:42 +0000 (GMT) Received: from pearl.ibctech.ca (dev.eagle.ca [209.167.58.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92ACB43D39 for ; Fri, 3 Sep 2004 14:09:38 +0000 (GMT) (envelope-from iaccounts@ibctech.ca) Received: (qmail 959 invoked by uid 1002); 3 Sep 2004 14:10:51 -0000 Received: from iaccounts@ibctech.ca by pearl.ibctech.ca by uid 89 with qmail-scanner-1.22 (clamscan: 0.73. spamassassin: 2.64. Clear:RC:1(127.0.0.1):. Processed in 1.40738 secs); 03 Sep 2004 14:10:51 -0000 Received: from unknown (HELO webmail.ibctech.ca) (127.0.0.1) by localhost.ibctech.ca with SMTP; 3 Sep 2004 14:10:49 -0000 Received: from 209.167.16.15 (SquirrelMail authenticated user steve@ibctech.ca); by webmail.ibctech.ca with HTTP; Fri, 3 Sep 2004 10:10:49 -0400 (EDT) Message-ID: <3330.209.167.16.15.1094220649.squirrel@209.167.16.15> In-Reply-To: <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> References: <1D64B3BF-FDAF-11D8-ABDA-000D9338770A@chrononomicon.com> <20040903140215.GB23032@happy-idiot-talk.infracaninophile.co.uk> Date: Fri, 3 Sep 2004 10:10:49 -0400 (EDT) From: "Steve Bertrand" To: "Matthew Seaman" User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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 14:09:42 -0000 > 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. Won't a simple symlink of /var/db/mysql to a new location (ie. /usr/db/mysql) after the directory is moved perform the same task, without the need to re-install? I've never done this, but it may work, and save some troubles. Steve > > 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 >