PHP5.3.10とMySQL5.5アップデート

「外部リポジトリの導入」のPHP5.3.10にアップデートと同時に、依存関係のMySQL5.1を5.5にアップデートするとMySQLが起動できない現象について対処方法がわかったので、MySQLも同時に5.5へアップデートすることにしました。
起動できない原因はmy.cnfに5.5ではサポートされていない変数等が設定されているためでした。私の環境では文字コード変数を変更しました。

それでは実際の手順

先に 「外部リポジトリの導入」をしておきます。

PHP5.3.10へアップデート(依存関係のMySQLも同時に更新されます)

# yum --enablerepo=remi -y update php

MySQLが起動できないのでログを確認します。エラーが出ています。

# less /var/log/mysqld.log

[ERROR] /usr/libexec/mysqld: unknown variable 'default-character-set=utf8'
[ERROR] Aborting

設定ファイルの文字コード変数を修正します。

# vi /etc/my.cnf

[mysqld]
…
#default-character-set=utf8 (#コメントアウトか削除)
character-set-server=utf8 (追加)

[mysql]
default-character-set=utf8
※[mysql]の部分はそのまま

これでMySQLを起動することができますが、ログを見ると別のエラーが出ています。

# less /var/log/mysqld.log

[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
[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'.'setup_consumers' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'threads' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
[ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
[ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure

データベースをアップデートします。

# mysql_upgrade -u <ユーザ名> -p
Enter password:<パスワード>
…
OK

MySQLを再起動します。

# /etc/init.d/mysqld restart

エラーが発生していないことを確認します。

# less /var/log/mysqld.log

参考
http://www.icoro.com/201109206113.html
http://www.softel.co.jp/blogs/tech/archives/2244
http://d.hatena.ne.jp/nemunemu10/20110811/1313016590