Home > MySQLのインストール

MySQLのインストール

  • 2012-01-27 (金) 15:52

MySQLのインストール

http://www.mysql.com/

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

libtermcap-develを入れておく
yum install libtermcap-devel bison flex
yum install compat-libtermcap bison flex
yum install 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 \

プラグインの為以下は外す
--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 --add mysql

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

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

MySQLを複数インストール

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

cp932の場合
CC=gcc \
CFLAGS="-O3 -m32 -msse3 -march=core2 -mtune=core2 -I/usr/local/include" \
CXX=gcc \
CXXFLAGS="-O3 -m32 -msse3 -march=core2 -mtune=core2 -felide-constructors -I/usr/local/include" \
LDFLAGS="-L/usr/local/lib" \
./configure \
--prefix=/usr/local/mysql2 \
--sysconfdir=/usr/local/mysql2/etc \
--with-unix-socket-path=/tmp/mysql2.sock \
--with-tcp-port=3307 \
--with-charset=cp932 \
--with-extra-charsets=complex \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--enable-thread-safe-client \
--enable-local-infile \
--enable-assembler \
--disable-shared \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \

make

make install

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

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

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

自動起動に追加
chkconfig --add mysql2

とりあえず起動してみる
/usr/local/mysql2/bin/mysqld_safe --defaults-file=/usr/local/mysql2/etc/my.cnf --user=mysql &

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

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://acoustype.com/mysql%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/trackback
Listed below are links to weblogs that reference
MySQLのインストール from acoustype.com

Home > MySQLのインストール

Search
Feeds
Meta

Return to page top