Oracle の RPM で install した MySQL 5.5 から 5.6 への upgrade 手順
例として、5.5.28 -> 5.6.17 への upgrade 手順を記します。
Oracle の RPM を使う場合の手順です。
Oracle の mysql-community repo から yum で入れている場合は、
yum upgrade でできると思います。
RPM 取得
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-server-5.6.17-1.el6.x86_64.rpm $ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-client-5.6.17-1.el6.x86_64.rpm $ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-5.6.17-1.el6.x86_64.rpm $ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-devel-5.6.17-1.el6.x86_64.rpm $ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-shared-compat-5.6.17-1.el6.x86_64.rpm
MySQL-server 以外を upgrade
MySQL-server も一緒に upgrade しない理由は後述します。
$ rpm -U MySQL-client-5.6.17-1.el6.x86_64.rpm MySQL-devel-5.6.17-1.el6.x86_64.rpm MySQL-shared-5.6.17-1.el6.x86_64.rpm MySQL-shared-compat-5.6.17-1.el6.x86_64.rpm
upgrade MySQL-server (失敗)
rpm -U でできるとおもいきや、以下の様なエラーがでます。
$ rpm -U MySQL-server-5.6.17-1.el6.x86_64.rpm ****************************************************************** A MySQL server package (MySQL-server-5.5.28-1.el6.x86_64) is installed. Upgrading directly from MySQL 5.5 to MySQL 5.6 may not be safe in all cases. A manual dump and restore using mysqldump is recommended. It is important to review the MySQL manual's Upgrading section for version-specific incompatibilities. A manual upgrade is required. - Ensure that you have a complete, working backup of your data and my.cnf files - Shut down the MySQL server cleanly - Remove the existing MySQL packages. Usually this command will list the packages you should remove: rpm -qa | grep -i '^mysql-' You may choose to use 'rpm --nodeps -ev <package-name>' to remove the package which contains the mysqlclient shared library. The library will be reinstalled by the MySQL-shared-compat package. - Install the new MySQL packages supplied by Oracle and/or its affiliates - Ensure that the MySQL server is started - Run the 'mysql_upgrade' program This is a brief description of the upgrade process. Important details can be found in the MySQL manual, in the Upgrading section. ****************************************************************** error: %pre(MySQL-server-5.6.17-1.el6.x86_64) scriptlet failed, exit status 1 error: install: %pre scriptlet failed (2), skipping MySQL-server-5.6.17-1.el6
まとめると、
- mysqldump をとっておいたほうが良い
- MySQL-server を uninstall してから入れなおしましょう
- MySQL-server を起動して、mysql_upgrade を実行しましょう
と言った感じでしょう。
mysqldump
念のため backup を取ります。
$ mysqldump -u root --all-databases --single-transaction > backup.sql
remove MySQL-server
$ rpm -e MySQL-server
install MySQL-server 5.6.17
$ rpm -ivh MySQL-server-5.6.17-1.el6.x86_64.rpm
start MySQL-server
$ chkconfig mysql on $ service mysql start