I am using RPM.  And for Centos 5 it was installing a lower version
of mysql than what was installed with the system.  That is why I want
to check before doing the RPM.  I guess the alternative is to use the
latest version all the time, but not sure whether that will work on
the 4.5 version.

The other thing is, mysql appears to keep changing between
/etc/init.d/mysqld and /etc/init/mysql so I also have to do an
ls /etc/init.s/mysql* to figure out what to use to start which is also
kind of a pain.

-----Original Message-----
From: Johan De Meersman [mailto:vegiv...@tuxera.be]
Sent: Thursday, January 14, 2010 09:44 AM
To: tony.chamberl...@lemko.com
Cc: mysql@lists.mysql.com
Subject: Re: version

You *should* be using a package manager (perfectly fine RPMs available for
all your needs), but if you must do this, it's a reasonably safe bet to
right-align and zero-pad all your number to 4 digits, at which point you're
free to concatenate them and treat them as a single number.

14.12.5.0.19 then becomes 0014 0012 0005 0000 0019 which becomes
140012000500000019.

You'd probably be safe with 3 or maaaaaaaybe even two positions, depending
on how many releases get done :-)

The better-but-more-work way is to compare every number separately, starting
with the major release.


On Thu, Jan 14, 2010 at 4:21 PM, <tony.chamberl...@lemko.com> wrote:

> I have an install script that does some stuff with mysql (i.e. install,
> start, etc).  It installs
> mysql  Ver 14.12 Distrib 5.0.19, for pc-linux-gnu (i686) using readline 5.0
>
> This was good when we just used CentOS 4.5.  Now we are doing some later
> CentOS versions and the mysql version may be higher.
>
> I want to do something like  "mysql --version" and process the result and
> if the version is >= 5.0.19 skip the mysql installation and just do the
> other stuff.  I can't compare as it is right now because the . and stuff
> may screw up the comparison (e.g. ver 5.2 will show as greater than 5.19
> eg).
>
> I want to know, if I break the individual pieces like 14 12 5 0 19 I can do
> some sort of calculation to determine a number that I can actually compare.
> Or can I just remove all the decimal points, like 14.12.5.0.19 becomes
> 14125019?  I might have to make it like  14120050019 or something.
>
> What is an algorithm I can use?
>
>
> Thanks
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=vegiv...@tuxera.be
>
>


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to