MySQL Upgrade (Linux)

  • 7019194
  • 10-Oct-2013
  • 09-Feb-2018

Environment

Retain
MySQL 5.x
Linux (for Windows, see "Upgrading MySQL (Windows)")

Situation

I would like to upgrade to Retain 3.x; however, the current database is MySQL 5.1 and Retain 3.x requires 5.5.x or 5.6.x (recommended to install 5.6 if you're upgrading)

DISCLAIMER:

This knowledgebase (KB) article is provided for informational purposes only and as a courtesy service to you, our customer. GWAVA Technical Support does not have any database administration (DBA) expertise, nor does it provide DBA services or support. GWAVA is not responsible for the results of implementing any of the concepts contained in this KB article. Implementation of any of the concepts suggested in this KB article shall be done entirely at your own and sole risk, and GWAVA does not provide any kind of warranties whatsoever resulting from your decision of implementing any of the KB article’s concepts. It is up to you to do any research and to ensure yourself that any implementation and setup of any of the KB article’s concepts in your database system is correctly and properly executed. It is imperative that you have backups of your database system and storage directory before making any implementation. If you don’t have any DBA expertise, you should consult with a DBA expert before any implementation of the KB article’s concepts.  Under no circumstances, shall GWAVA, or any of its employees, be liable, in contract, tort, delict or otherwise, whether negligence is provable or not, for any direct, indirect, incidental, special, punitive, consequential or other damages, loss, cost or liability whatsoever that would result from or are related to the implementation of any of the concepts suggested in the KB article.


To the extent permitted by applicable law, GWAVA shall not be liable to you for any special, consequential, direct, indirect or similar damages, including any loss of data, arising out from migrating any type of messages, attachments, database, metadata in your Retain system to another server and/or location.

Resolution

MySQL must be upgraded.
 

1.  Stop Tomcat on the Retain server.

2.  Perform a dump of the database.

3.  Download MySQL 5.5.x. 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.
a)  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".

b)  Check for any other MySQL RPMs.
rpm -qa | grep -i mysql

Sample screen output:

c)  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 without using the Retain installation's "mysqlsetup.sh".

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

8.  Install MySQL 5.5 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.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2222.