Assuming that the server has a 3306 instance running, we will add another 3316 port instance.
Edit/etc/my.cnf directly and add the following (the Red section is the post-add configuration Item):
[Client]
user= Root
socket=/tmp/mysql.sock
Port= 3306
[MySQL]
Prompt= ' [\d] > '
[Mysqld]
Datadir=/bdata/data/nowdb2
socket=/tmp/mysql.sock
User=mysql
Port= 3306
Character-set-server= UTF8
Default_storage_engine= InnoDB
Transaction_isolation = read-committed
Skip_name_resolve= on
Skip_external_locking
Query_cache_type= OFF
Query_cache_size= 0
Server-id= 11
log-bin= Mysql.bin
binlog_format= ROW
Log_error=/bdata/data/nowdb2/error.log
Innodb_file_per_table = On
[Mysqld_multi]
Mysqld =/usr/local/mysql/bin/mysqld_safe
Log =/var/log/mysqld_multi.log
[Mysqld2]
Datadir=/data/mysql2
Socket =/tmp/mysql2.sock
User=mysql
Port = 3316
Character-set-server = UTF8
Default_storage_engine = InnoDB
Transaction_isolation =read-committed
Skip_name_resolve = On
Skip_external_locking
Server-id = 106
Log-bin = Mysql-bin
Slow_query_log = On
Slow_query_log_file =/data/mysql2/localhost_slow.log
Long_query_time = 5
Log_error =/data/mysql2/error.log
Innodb_file_per_table = On
Innodb_flush_log_at_trx_commit = 1
Sync_binlog = 1
Innodb_support_xa = 1
Sql_mode=no_engine_substitution,strict_trans_tables
Symbolic-links=0
Relay_log_info_repository = table
Master_info_repository = table
Relay_log_recovery = On
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld.pid
[Mysqldump]
Quick
max_allowed_packet= 64M
Initialize the 3316 instance:
/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql2/
Launch 3316 instance:
Mysqld_multireport
Mysqld_multistart 3316 launches 3316 instances.
In the same way, other MySQL instances can be configured.
If you close, we recommend using Mysqladmin.
Note that the start stop of the Mysqld_mulit and the original mysqld does not have any relationship. We can close/etc/init.d/mysqld and have no effect on MYSQLD_MULTI-initiated instances.
Mysqld_multi multiple instances to start MySQL