求助:mysql 多个端口配置/多实例安装
发布网友
发布时间:2022-04-27 10:58
我来回答
共1个回答
热心网友
时间:2022-04-07 18:33
给你个linux的配置 my.cnf的内容
[mysqld_multi]
mysqld=/usr/local/mysql/bin/mysqld_safe
[client]
socket = /tmp/mysql.sock
default-character-set=utf8
[mysqld1]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
character-set-server=utf8
default-storage-engine=innodb
port = 3306
table_open_cache = 64
innodb_data_home_dir = /usr/local/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data
innodb_buffer_pool_size = 50M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
[mysqld2]
datadir=/usr/local/mysql/data1
basedir=/usr/local/mysql
character-set-server=utf8
default-storage-engine=innodb
port = 3307
table_open_cache = 64
innodb_data_home_dir = /usr/local/mysql/data1
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data1
innodb_buffer_pool_size = 50M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
----【mysqld】中的配置和单实例的mysqld配置一致,多实例中每个[mysqld]需要有不同的端口号,sock,datadir
然后是启动:/usr/local/mysql/bin/mysqld_mulit --defaults-extra-file=/etc/my.cnf start 1
----这里的数字1 对应[mysqld1] ,关闭就是 把start 改成stop,启动所有就是 start all
其他命令你自己网上查下吧追问windows上面有没什么方案可以实现
追答windows的话没这么配置过,只是安装了多个mysql而已,去下载免安装的mysql,然后解压到不同的目录,配置端口就行了