On 5/2/06, Yves Goergen <[EMAIL PROTECTED]> wrote:

But upgrading MySQL like installing it
after MySQL's guide brings a problem: I'd need to move the data
directory to the new programme directory every time.

That is what I do. I find it easier than moving the data directory to
a non-standard location.
I wrapped it all in a shellscript to be run by root.

Assuming mysql is installed in /usr/local like this:

lrwxr-xr-x  1 root wheel  37 May  2 14:34 mysql ->
mysql-standard-5.0.20a-osx10.4-powerpc
drwxr-xr-x 19 root mysql 646 May  2 14:34 mysql-standard-5.0.20a-osx10.4-powerpc

And I have a tar.gz 'mysql-standard-5.0.21-osx10.4-powerpc.tar.gz',
and the script below is called 'update-mysql.sh', this:

# update-mysql.sh mysql-standard-5.0.21-osx10.4-powerpc.tar.gz

Updates mysql to version 5.0.21. All I have to do manually is remove
the directory with the old version. I'm sure I could automate that
also but I thought it was good enough like this.

#!/bin/sh

tarfile=$1
usrlocal='/usr/local'
olddir='mysql'
newdir=${tarfile%.tar.gz}
password='secret'

mysqladmin -u root --password=$password shutdown
sleep 5
mv $tarfile $usrlocal
cd $usrlocal
tar xvzf $tarfile
cd $newdir
rm -r data
chown -R root:mysql .
cd ../$olddir
mv data ../$newdir/
cd ..
rm $olddir
ln -s $newdir $olddir
rm $tarfile
mysqld_safe &

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

Reply via email to