暫く放置していたMySQLのバージョンをそろそろあげることにした。
調べてみると一回MySQLアンインストールしないとダメみたいなので
止めて1つずつ消していく。
(DBとmy.cnfのバックアップをとってから作業開始)
まずMySQLを止める
$ sudo /etc/init.d/mysqld stop
リポジトリの更新
$ wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/i386/ius-release-1.0-13.ius.centos6.noarch.rpm $ wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/i386/epel-release-6-5.noarch.rpm $ rpm -Uvh ius-release-1.0-13.ius.centos6.noarch.rpm $ rpm -Uvh epel-release-6-5.noarch.rpm
ちゃんと更新されていることを確認
$ rpm -qa|grep ius-release ius-release-1.0-13.ius.centos6.noarch $ rpm -qa|grep epel-release epel-release-6-8.noarch
今入っているものを一覧に出して1つずつyum removeで消す。
$ rpm -qa | grep mysql | sort
※ここでボーっとしててphpまで消してしまった(;´ω`)
なので慌ててphpをインストール。
$ yum --enablerepo=remi,epel install php php-mbstring php-mysql
MySQL 5.6を入れる。
$ yum -y install mysql56u-server mysqlclient16 mysql56u mysql56u-devel mysql56u-libs mysql56u-bench ・ ・ =========================================================================================================================== Package Arch Version Repository Size =========================================================================================================================== Installing: mysql56u x86_64 5.6.20-2.centos6 ius 6.7 M mysql56u-bench x86_64 5.6.20-2.centos6 ius 438 k mysql56u-devel x86_64 5.6.20-2.centos6 ius 209 k mysql56u-libs x86_64 5.6.20-2.centos6 ius 679 k mysql56u-server x86_64 5.6.20-2.centos6 ius 12 M mysqlclient16 x86_64 5.1.61-4.ius.centos6 ius 1.4 M Installing for dependencies: mysql56u-common x86_64 5.6.20-2.centos6 ius 214 k perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k Transaction Summary =========================================================================================================================== Install 8 Package(s) ・ ・
ちゃんと5.6になってるかバージョン確認。
$ mysql --version mysql Ver 14.14 Distrib 5.6.20, for Linux (x86_64) using EditLine wrapper
とりあえず大丈夫そう。
$ rpm -qa | grep php | sort php-5.3.3-27.el6_5.1.x86_64 php-cli-5.3.3-27.el6_5.1.x86_64 php-common-5.3.3-27.el6_5.1.x86_64 php-mbstring-5.3.3-27.el6_5.1.x86_64 php-mysql-5.3.3-27.el6_5.1.x86_64 php-pdo-5.3.3-27.el6_5.1.x86_64 $ rpm -qa | grep mysql | sort mysql56u-5.6.20-2.centos6.x86_64 mysql56u-bench-5.6.20-2.centos6.x86_64 mysql56u-common-5.6.20-2.centos6.x86_64 mysql56u-devel-5.6.20-2.centos6.x86_64 mysql56u-libs-5.6.20-2.centos6.x86_64 mysql56u-server-5.6.20-2.centos6.x86_64 mysqlclient16-5.1.61-4.ius.centos6.x86_64 php-mysql-5.3.3-27.el6_5.1.x86_64
というわけでMySQLを動かす。
$ sudo /etc/init.d/mysqld start mysqld を起動中: [ OK ]
無事動いているのを確認。
念のため、エラーログも見てみたら…エラーがいっぱい出ている(>_<)
[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure [ERROR] Native table 'performance_schema'.'events_waits_summary_by_host_by_event_name' has the wrong structu ・ ・ ・
調べてみると一番最初に出ているエラーに対応すれば良いらしい。
mysql_upgradeを動かせばokみたいなので…
$ mysql_upgrade -uroot -p Enter password: Looking for 'mysql' as: mysql Looking for 'mysqlcheck' as: mysqlcheck ・ ・ ・
再起動してもエラーは出なくなった。
$ sudo /etc/init.d/mysqld restart mysqld を停止中: [ OK ] mysqld を起動中: [ OK ]
これで完了。…かな(^^;)
■参考にしたサイト
【MySQL】5.1から5.5へのアップグレード(rpmで) at softelメモ
mysql5.1系からmysql5.5系へアップグレードする | レンタルサーバー・自宅サーバー設定・構築のヒント
CentOSのMySQLを5.5から5.6にアップデートする | karakaram-blog