MySQL5.5のインストール

http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.html

yum install ncurses-devel

インストール先のディレクトリを作る
mkdir /usr/local/mysql

グループの追加
groupadd mysql

ユーザーの追加
adduser -g mysql -d /usr/local/mysql/data mysql

/usr/local/bin/cmake -E tar zxvf mysql-5.5.35.tar.gz

cd mysql-5.5.35

CFLAGS="-m64 -march=native -g -O3" \
CXXFLAGS="-m64 -march=native -g -O3" \
/usr/local/bin/cmake . \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_CC_COMPILER=gcc \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_LAYOUT=STANDALONE \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DCOMPILATION_COMMENT="自己流" \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLE_DEBUG_SYNC=0 \
-DENABLE_DTRACE=true \
-DENABLE_GCOV=true \
-DENABLED_LOCAL_INFILE=true \
-DENABLED_PROFILING=true \
-DWITH_DEBUG=false \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_EXTRA_CHARSETS=complex \

make -j

make install

cd /usr/local/mysql

chown -R mysql .
chgrp -R mysql .

scripts/mysql_install_db --user=mysql

chown -R root .
chown -R mysql data

cp support-files/my-huge.cnf /etc/my.cnf

bin/mysqld_safe --user=mysql &

cp support-files/mysql.server /etc/init.d/mysql

MySQLのインストール

http://www.mysql.com/

コンパイルに必要なツール

libtermcap-develを入れておく
yum install bison flex compat-libtermcap libtermcap-devel ncurses-devel

インストール先のディレクトリを作る
mkdir /usr/local/mysql

グループの追加
groupadd mysql

ユーザーの追加
adduser -g mysql -d /usr/local/mysql/var mysql

cp932の場合
CC=gcc \
CFLAGS="-O3 -msse3 -march=core2 -mtune=core2 -I/usr/local/include -fPIC" \
CXX=gcc \
CXXFLAGS="-O3 -msse3 -march=core2 -mtune=core2 -felide-constructors -I/usr/local/include -fPIC" \
LDFLAGS="-L/usr/local/lib" \
./configure \
--prefix=/usr/local/mysql \
--with-mysqld-user=mysql \
--with-charset=cp932 \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--enable-assembler \
--disable-shared \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--without-debug \
--with-big-tables \
--with-pic \
--with-plugins=partition,heap,innobase,innodb_plugin,myisam \

eucjpmsの場合
CC=gcc \
CC=gcc \
CFLAGS="-O3 -msse3 -march=core2 -mtune=core2 -I/usr/local/include -fPIC" \
CXX=gcc \
CXXFLAGS="-O3 -msse3 -march=core2 -mtune=core2 -felide-constructors -I/usr/local/include -fPIC" \
LDFLAGS="-L/usr/local/lib" \
./configure \
--prefix=/usr/local/mysql \
--with-mysqld-user=mysql \
--with-charset=eucjpms \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--enable-assembler \
--disable-shared \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--without-debug \
--with-big-tables \
--with-pic \
--with-plugins=partition,heap,innobase,innodb_plugin,myisam \

make

make install

MySQL 5.1 innodb_plugin cp932の場合

CC=gcc \
CFLAGS="-O3 -I/usr/local/include -fPIC" \
CXX=gcc \
CXXFLAGS="-O3 -felide-constructors -I/usr/local/include -fPIC" \
LDFLAGS="-L/usr/lib -L/usr/lib64 -L/usr/local/lib -L/usr/local/lib64" \
./configure \
--prefix=/usr/local/mysql \
--with-mysqld-user=mysql \
--with-charset=cp932 \
--with-extra-charsets=complex \
--with-pic \
--with-plugins=partition,heap,innobase,innodb_plugin,myisam,myisammrg \
--without-debug \
--with-mysqlmanager \
--with-embedded-server \
--with-big-tables \
--with-readline \
--enable-thread-safe-client \
--enable-profiling \
--enable-local-infile \
--enable-assembler \
--without-docs \
--without-man \

MySQL 5.1 innodb_plugin utf8の場合

CC=gcc \
CFLAGS="-O3 -march=native -mtune=native -I/usr/local/include -fPIC" \
CXX=gcc \
CXXFLAGS="-O3 -march=native -mtune=native -felide-constructors -I/usr/local/include -fPIC" \
LDFLAGS="-L/usr/lib -L/usr/lib64 -L/usr/local/lib -L/usr/local/lib64" \
./configure \
--prefix=/usr/local/mysql \
--with-mysqld-user=mysql \
--with-charset=utf8 \
--with-extra-charsets=complex \
--with-pic \
--with-plugins=partition,heap,innobase,innodb_plugin,myisam,myisammrg \
--without-debug \
--with-mysqlmanager \
--with-embedded-server \
--with-big-tables \
--with-readline \
--enable-thread-safe-client \
--enable-profiling \
--enable-local-infile \
--enable-assembler \
--without-docs \
--without-man \

プラグインの為以下は外す
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--disable-shared \

innodb_plugin

innodb_file_per_table
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so;innodb_trx=ha_innodb_plugin.so;innodb_locks=ha_innodb_plugin.so;innodb_lock_waits=ha_innodb_plugin.so;innodb_cmp=ha_innodb_plugin.so;innodb_cmp_reset=ha_innodb_plugin.so;innodb_cmpmem=ha_innodb_plugin.so;innodb_cmpmem_reset=ha_innodb_plugin.so

groonga_default_parser=TokenMecab

skip-character-set-client-handshake
character-set-server=cp932
skip-name-resolve
max_connections=100
max-user-connections=100
max_connect_errors=100000

select @@innodb_version;

MySQLの初期化
/usr/local/mysql/bin/mysql_install_db --user=mysql

ディレクトリの所有者変更
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/var

設定ファイルをコピーする(my.cnf)
cd support-files
cp mysql.server /etc/rc.d/init.d/mysql
chmod 755 /etc/rc.d/init.d/mysql
cp my-huge.cnf /etc/my.cnf

自動起動に追加
chkconfig mysql on

とりあえず起動してみる
/usr/local/mysql/bin/mysqld_safe --user=mysql &

rootにパスワードを設定
/usr/local/mysql/bin/mysqladmin -u root password '新しいパスワード'

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です