Tuesday, February 27, 2018

Installation of MySQL

My favorite way of MySQL installation is to go with tar ball.

It is easy, simple and manageable.

There is also other thoughts people would think the tarball has many limitations and restrictions in terms of package dependency and functional incompatibility with the OS. 

If certain functions are not available in generic tarball but they are available in rpm or package bundle, tarball may not be the choice.

The platform to go for is for those with the package repository (yum or apt_get) support.  

Steps for installation  (This is only my way!!!)
1.   Remove any MySQL package from the OS  
      There is a chance the OS may come with packages of MySQL installation from community.   To make sure we have a clean environment, it is good to remove all of them.

2.   Using OS's package installer (yum / apt_get) to install the proper MySQL package with the same version.   This is to ensure that any other package dependency can be resolved easily and automatically.   
 
3.  Remove the MySQL package but not any dependency packages.  This clean up MySQL installation and the OS has no more MySQL binary.

4.  Untar the tarball to MySQL binary folder (e.g. export MYSQL_BINARY=/opt/mysql
       cd $MYSQL_BINARY; tar -zxvf  <tarball>   

5.  link the /usr/local/mysql   as the latest to the MYSQL_BINARY
    ln -s $MYSQL_BINARY/<mysql version binary>  /usr/local/mysql

6.  Change ownership for /usr/local/mysql and the $MYSQL_BINARY/<mysql version binary>

Within the $MYSQL_BINARY folder, it may  contain more than one version of MySQL binary.   If the system supports multiple version of MySQL, it is doable.

In some cases, testing of upgrade from version to version, more than one version of MySQL binary installations is required.  There is also chance to recover data from old data backup which may require old version of MySQL.