序言:多實例?Why?
隨著硬件層面的發展,linux系統多核已經是普通趨勢,而mysql是單進程多線程,所以先天上對多進程的利用不是很高,雖然5.6版本已經在這方面改進很多,但是也沒有達到100%,所以為了充分的利用系統資源,mysql有自己的補充,那就是可以部署多實例,一個實例一個端口。
源碼安裝mysql參考blog:http://www.Bkjia.com/database/201407/313004.html,源碼包下載地址:http://download.csdn.net/detail/mchdba/7545037
groupaddmysql
useradd-g mysql mysql
autoreconf--force --install
libtoolize--automake --force
automake--force --add-missing
yuminstall -y libtoolize
yuminstall cmake -y
yuminstall gcc gcc-c++ -y
yuminstall -y ncurses-devel.x86_64
yuminstall -y cmake.x86_64
yuminstall -y libaio.x86_64
yuminstall -y bison.x86_64
yuminstall -y gcc-c++.x86_64
yuminstall make -y
mkdir-p /usr/local/mysql
tar -xvf mysql-5.6.12.tar.gz
cd mysql-5.6.12
timecmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/home/data/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql/mysql.sock -DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
由於time make耗時比較長,所以事先已經安裝好
timemake
timemake install
mkdir /usr/local/mysql3307
chown -R mysql.mysql /usr/local/mysql3307/
mkdir -p /home/data/mysql3307/data
chown -R mysql.mysql /home/data/mysql3307
chown -R mysql.mysql/home/data/mysql3307/data
mkdir -p /home/data/mysql3307/binlog
chown -R mysql.mysql /home/data/mysql3307
mkdir -p /home/data/mysql3307/relay_log/
chown -R mysql.mysql /home/data/mysql3307/
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin =/usr/local/mysql/bin/mysqladmin
log =/home/mysql/mydata/log/mysqld_multi.log
[mysqld1]
socket = /usr/local/mysql3307/mysql.sock
port = 3307
pid-file = /usr/local/mysql3307/mysqld.pid
datadir = /home/data/mysql3307/data
log_bin=/home/data/mysql3307/binlog
server-id = 1230
relay_log =/home/data/mysql3307/relay_log/mysql-relay-bin
log_slave_updates = 1
read_only = 0
innodb_buffer_pool_size = 128M
innodb_flush_log_at_trx_commit = 0