Apologies, I didn't read your initial posting properly. Perhaps a glance
at this http://dev.mysql.com/doc/refman/5.0/en/mysqld-multi.html would
provide you the facilities that you require for using multiple servers.

This work well and enables you to manage the multiple global
configuration files required.

Regards

Hi Yves,

You could also have changed the directory in the global /etc/my.cnf file
by setting

datadir=/path/to/mysql/data

This is pretty simple and works a lot easier than hacking the init
scripts.

Regards 



---------------------------------------------------------------
********** _/     **********  David Logan 
*******   _/         *******  ITO Delivery Specialist - Database
*****    _/            *****  Hewlett-Packard Australia Ltd
****    _/_/_/  _/_/_/  ****  E-Mail: [EMAIL PROTECTED]
****   _/  _/  _/  _/   ****  Desk:   +618 8408 4273
****  _/  _/  _/_/_/    ****  Mobile: 0417 268 665
*****        _/       ******    
******      _/      ********  Postal: 148 Frome Street,
********   _/     **********          Adelaide SA 5001
                                      Australia 
i    n    v    e    n    t                                   
---------------------------------------------------------------

-----Original Message-----
From: Yves Goergen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 3 May 2006 8:01 PM
To: paul rivers
Cc: mysql@lists.mysql.com
Subject: Re: How to move the MySQL data directory?

On 03.05.2006 01:21 (+0100), paul rivers wrote:
> Specify the data dir in the local my.cnf and be sure your instance
uses it
> by starting it with the --defaults-file parameter set to that
instance's
> local copy.

Okay, since hacking seems to be required anyway, I hacked it the
straight-forward and least-change way. I already had datadir=... changed
in the init script to the correct location. Now I also insert some
variables corrections in bin/mysqld_safe:

  # here are the lines where ledir is set totally wrong...

  MY_BASEDIR_VERSION=`pwd`
  ledir=${MY_BASEDIR_VERSION}/bin
  DATADIR=`pwd | sed -r "s;/usr/local/;/var/;"`/data
  defaults="--defaults-file=${DATADIR}/my.cnf"

  # user=... and so on

This does the job pretty well for MySQL 4.0. Need to do it with every
upgrade, but I think I can automate it.

MySQL 5.0 required a less invasive hack though. I saw that setting
datadir= in the proposed init script is for nothing at the very
beginning since it's overwritten again right below. So moving that line
further down helped. Then the mysqld_safe call in the 'start' section
required an additional parameter --defaults-file=$datadir/my.cnf to make
it read my socket name, IP & port etc.

Now both servers are up and running fine again, side by side, with the
*entire* data directory moved somewhere else, saving me from handling
that with every upgrade. Thanks for your help, I thought it could be
done an easy way but it seems nobody has thought about doing that
before. At least I don't have the impression, from reading the scripts.

-- 
Yves Goergen "LonelyPixel" <[EMAIL PROTECTED]>
http://beta.unclassified.de - My web laboratory.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to