2.8 Upgrading MySQL to a New Version

2.8.1 Upgrading MySQL on Linux

Upgrading and existing MySQL on a Retain server.

  1. Stop Tomcat on the Retain server. See Starting and Stopping 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 are recreated 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.

2.8.2 Upgrading MySQL on Windows

Upgrading MySQL

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

  2. Perform a dump of the database.

  3. Download MySQL onto the server on which you want to install it.

  4. Install MySQL and configure the retain database. Refer to the appendix of the Windows Install Guide for instructions.

  5. Import the dump into the new retain database.

    1. Open a command window (cmd).

    2. Change directories to: C:\Program Files\MySQL\MySQL Server 5.0\bin (the beginning of the path depends upon where MySQL was installed).

    3. Type: mysql -u root -p retain < [path to dump file]\[dump filename]

      EX: mysql -u root -p retain < d:\dump\2013-12-11.sql

      NOTE:This assumes that the ..\MySQL\bin directory is in the path.

  6. (Optional) Reboot the server to clear memory; otherwise, just start Tomcat.