echo "CHOST=\"x86_64-pc-linux-gnu\" \
CFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer\" \
CXX=gcc CXXFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti\" \
./configure --prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--enable-assembler --with-libwrap=/usr/lib/ \
--with-charset=gbk --with-extra-charsets=gb2312,gbk,big5,latin1,utf8 \
--with-mysqld-user=mysql --with-big-tables \
--with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static \
--with-plugins=myisam,myisammrg,innobase,innodb_plugin,heap,csv,partition" > configure.sh
chmod +x configure.sh && ./configure.sh && make && make install
groupadd mysql && useradd -g mysql mysql
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld && chkconfig --level 345 mysqld on
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R root . && chown -R mysql var && chgrp -R mysql .
bin/mysqld_safe --user=mysql &
bin/mysqladmin -uroot -poldpwd password 'NEW_PASSWORD'
核心差異:不同端口、不同數據目錄、不同 server-id、獨立配置文件、獨立啟動腳本。
cp support-files/mysqld_multi.server /etc/rc.d/init.d/mysqld_multi
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var21001/
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var21002/
bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var21003/
GRANT REPLICATION SLAVE ON *.* TO 'repsync'@'%' IDENTIFIED BY '*********';
FLUSH PRIVILEGES;