1. Source code package Download: HTTP://DOWNLOAD.SOFTAGENCY.NET/MYSQL/DOWNLOADS/MYSQL-5.1/
2. Compiling the installation
Groupadd Mysqluseradd-R-g MySQL MySQLmkdir/data/mysql_multi/mysql_exa1/CD/data/mysql_multi/mysql_exa1/mkdirData Binlog Logmkdir/data/mysql_multi/mysql_exa2/CD/data/mysql_multi/mysql_exa2/mkdirData Binlog LogChown-R mysql:mysql/data/mysql_multi/mysql_exa2//data/mysql_multi/mysql_exa1/adb/data/installs/mysql-5.1. the./configure--PREFIX=/USR/LOCAL/MYSQL5.1 Make Make InstallCD/usr/local/mysql5.1/bin/./mysql_install_db--user=mysql--basedir=/usr/local/mysql5.1--datadir=/data/mysql_multi/mysql_exa1/data/./mysql_install_db--user=mysql--basedir=/usr/local/mysql5.1--datadir=/data/mysql_multi/mysql_exa2/data/CP-rp. /share/mysql/mysqld_multi.server/etc/init.d/Mysql_multi #复制启动文件vim/etc/init.d/mysql_multi #修改basedir and DataDir
3. Configure multiple instances
[Mysqld_multi]mysqld=/usr/local/mysql5.1/bin/mysqld_safemysqladmin=/usr/local/mysql5.1/bin/mysqladminuser=Root #管理实例时指定的用户名和密码password= 1234[Client]#port= 3306#socket=/data/mysql_multi/mysql_exa1/mysql.sock[mysqld3307]Server-id= 3307Port= 3307Socket=/data/mysql_multi/mysql_exa1/mysql.sockpid-file=/data/mysql_multi/mysql_exa1/mysql.piddatadir=/data/mysql_multi/mysql_exa1/datalog-error=/data/mysql_multi/mysql_exa1/log/error.loglong_query_time= 1Slow_query_log_file=/data/mysql_multi/mysql_exa1/log/slow-query.loglog-bin=/data/mysql_multi/mysql_exa1/binlog/mysql-binlog-bin-index=/data/mysql_multi/mysql_exa1/binlog/mysql-bin.indexexpire_logs_days= 2Binlog_format=mixedskip-lockingkey_buffer_size=16mmax_allowed_packet=1mtable_open_cache= 64sort_buffer_size=512knet_buffer_length=8kread_buffer_size=256kread_rnd_buffer_size=512kmyisam_sort_buffer_size=8M[mysqld3308]Server-id= 3308Port= 3308Socket=/data/mysql_multi/mysql_exa2/mysql.sockpid-file=/data/mysql_multi/mysql_exa2/mysql.piddatadir=/data/mysql_multi/mysql_exa2/datalog-error=/data/mysql_multi/mysql_exa2/log/error.loglong_query_time= 1Slow_query_log_file=/data/mysql_multi/mysql_exa2/log/slow-query.loglog-bin=/data/mysql_multi/mysql_exa2/binlog/mysql-binlog-bin-index=/data/mysql_multi/mysql_exa2/binlog/mysql-bin.indexexpire_logs_days= 2Binlog_format=mixedskip-lockingkey_buffer_size=16mmax_allowed_packet=1mtable_open_cache= 64sort_buffer_size=512knet_buffer_length=8kread_buffer_size=256kread_rnd_buffer_size=512kmyisam_sort_buffer_size=8M[mysqldump]Quickmax_allowed_packet=16M[MySQL]No-auto-rehash[Myisamchk]key_buffer_size=20msort_buffer_size=20mread_buffer=2mwrite_buffer=2M[mysqlhotcopy]Interactive-timeout
4. Start multi-instance
[Email protected]192.168.100.246:/usr/local/mysql5.1/bin#/etc/init.d/mysqld_multi Start3307[email protected]192.168.100.246:/usr/local/mysql5.1/bin#/etc/init.d/mysqld_multi Start3308[email protected]192.168.100.246:/usr/local/mysql5.1/bin# NETSTAT-LNTP |grepMySQL TCP0 0 0.0.0.0:3306 0.0.0.0:* LISTEN26218/mysqld TCP0 0 0.0.0.0:3307 0.0.0.0:* LISTEN31910/mysqld TCP0 0 0.0.0.0:3308 0.0.0.0:* LISTEN32154/mysqld
5. Turn off multi-instance
5.1 Set the password separately
[Email protected]192.168.100.246:/usr/local/mysql5.1/bin# mysql-uroot-p-s/data/mysql_multi/mysql_exa1/Mysql.sock #指定sock文件路径登录Enter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connectionIDIs1Server Version:5.1. the-Log Source distributioncopyright (c) -, ., Oracle and/or its affiliates. All rights reserved. This software comes with absolutely NO WARRANTY. this is FreeSoftware,and You is welcome to modify and redistribute it under the GPL v2 licensetype'Help ;'Or'\h' forHelp. Type'\c'ToClearThe current input statement.mysql> Set Password=password ('1234'); Query OK,0Rows Affected (0.00sec) MySQL>flush Privileges; Query OK,0Rows Affected (0.00sec) [Email protected]192.168.100.246:/usr/local/mysql5.1/bin# mysql-uroot-p-s/data/mysql_multi/mysql_exa2/Mysql.sockenter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connectionIDIs1Server Version:5.1. the-Log Source distributioncopyright (c) -, ., Oracle and/or its affiliates. All rights reserved. This software comes with absolutely NO WARRANTY. this is FreeSoftware,and You is welcome to modify and redistribute it under the GPL v2 licensetype'Help ;'Or'\h' forHelp. Type'\c'ToClearThe current input statement.mysql> Set Password=password ('1234'); Query OK,0Rows Affected (0.00sec) MySQL>flush Privileges; Query OK,0Rows Affected (0.00Sec
5.2 Closing an instance
[Email protected]192.168.100.246:/usr/local/mysql5.1/bin#/etc/init.d/mysqld_multi Stop3307[email protected]192.168.100.246:/usr/local/mysql5.1/bin#/etc/init.d/mysqld_multi Stop3308[email protected]192.168.100.246:/usr/local/mysql5.1/bin# NETSTAT-LNTP |grepmysqltcp0 0 0.0.0.0:3306 0.0.0.0:* LISTEN26218/mysqld
6. Precautions
6.1 Mysql_multi.log Default path:/usr/local/mysql5.1/share/mysqld_multi.log
6.2 When adding an instance, you just need to add an instance-dependent configuration to the configuration file, launch the instance, and stop the instance similar
mysql-5.1.73 Multi-Instance installation start