% sudo yum -y install cmake bison ncurses-devel
% wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.24.tar.gz/from/http://ftp.iij.ad.jp/pub/db/mysql/
% tar -zxvf mysql-5.5.24.tar.gz
% cd mysql-5.5.24
% cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.24 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=true -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=O
% make
% sudo make install
% sudo cp support-files/my-medium.cnf /etc/my.cnf
% sudo vi /etc/my.cnf
★必要なら[client] [mysqld] のポートを適宜変える
port = 13406
★文字化け回避設定を [mysqld] セクションへ追記
character-set-server = utf8
★innodb関連オプションを有効化&追加 [mysqld]
innodb-file-per-table
★binlog設定を有効化 [mysqld]
# Uncomment the following if you want to log updates
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
★ログ設定 [mysqld]
log-error=/var/log/mysql/error.log
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow-queries.log
long_query_time = 2
log-queries-not-using-indexes
log-slow-admin-statements
log-output = FILE,TABLE
% sudo groupadd mysql
% sudo useradd -r -g mysql mysql
% cd /usr/local
% sudo chown -R mysql:mysql mysql-5.5.24
% cd mysql-5.5.24
% sudo scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.5.24 --datadir=/usr/local/mysql-5.5.24/data --no-defaults
% sudo chown -R root:root .
% sudo chown -R mysql:mysql data
% sudo mkdir /var/log/mysql
% sudo chown -R mysql:mysql /var/log/mysql
% sudo cp support-files/mysql.server /etc/init.d/
% sudo /etc/init.d/mysql.server start
% /usr/local/mysql-5.5.24/bin/mysqladmin -u root password "XXXX"
% /usr/local/mysql-5.5.24/bin/mysql -u root -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
% sudo /etc/init.d/mysql.server stop