一台windows主机安装多个mysql服务

1、本地安装mysql
一台windows主机安装多个mysql服务_第1张图片

2、新建一个文件“mysql2”,将上面的所有目录全部复制到该文件夹中
一台windows主机安装多个mysql服务_第2张图片
3、修改mysql2中my-default.ini
一台windows主机安装多个mysql服务_第3张图片

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir =D:\Program Files\mysql2\mysql-5.6.16-winx64
datadir =D:\Program Files\mysql2\mysql-5.6.16-winx64\data
port =3307
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

4、创建mysql服务

mysqld install MySQL4  --defaults-file="D:\Program Files\mysql2\mysql-5.6.16-winx64\my-default.ini"

这里写图片描述

5、修改注册表
一台windows主机安装多个mysql服务_第4张图片

HKEY_LOCAL_MACHINE–>SYSTEM–>CurrentControlSet–>Services
一台windows主机安装多个mysql服务_第5张图片

修改值为:
“D:\Program Files\mysql2\mysql-5.6.16-winx64\bin\mysqld” –defaults-file=”D:\Program Files\mysql2\mysql-5.6.16-winx64\my-default.ini” MySQL4

6、启动mysql服务
一台windows主机安装多个mysql服务_第6张图片

7、连接数据库

一台windows主机安装多个mysql服务_第7张图片

你可能感兴趣的:(MySQL)