4.15 MySQL Upgrade (Linux)

Upgrading and existing MySQL on a Retain server.

  1. Stop Tomcat Starting and Stopping Tomcat on the Retain server.

  2. Perform a dump of the database.

  3. Download MySQL onto the server on which you wish to install MySQL and un-tar it. Retain only needs the client and the server RPM's, but it is simpler to download one bundle file then two separate files.

  4. Stop MySQL: rcmysql stop

  5. Uninstall MySQL if upgrading to the same server; otherwise, skip to step #8.

    1. Check YaST | Software Management first for MySQL. Uninstall it from there if applicable.

      If it has a "lock" icon, it cannot be uninstalled from Software Management. Proceed to step "b".

    2. Check for any other MySQL RPMs.

      rpm -qa | grep -i mysql

      Sample screen output:

    3. Uninstall all instances of MySQL found in step b (if any) - but only the entries beginning with "MySQL..."

      rpm -e [current mysql rpm]

      Based on the screenshot shown above in in sub-step "b", I would type:

      rpm -e MySQL-server-community-5.1.72-1.sles11

      This has to be done for each RPM discovered.

  6. Delete or rename the entire "datadir" directory.

    This is the mysql directory containing the ibdata1 database and the "retain" subdirectory. It is no longer needed since you have already dumped the database. All of the files and subdirectories will be re-created without any loss of data as long as you have a good/current dump.

    The "datdir" directory is specified in the /etc/my.cnf. Look for the "[mysqld]" section. The first line reads, "datdir=[path]"

    If not specified in the my.cnf, the datadir could be at /var/lib/mysql. This is the default datadir directory if MySQL is installed manually.

  7. Rename /etc/my.cnf to my.cnf.old.

  8. Install MySQL and configure the retain database.

  9. Import the dump into the new retain database.

    mysql -u root -p retain < /[path to dump file]/[dump filename]

    To watch the progress of the import, use this command: watch "mysqladmin -u root -p[mysql root user pw] processlist"

  10. Reboot the server to clear the memory; otherwise, start up Tomcat and you are done.