Windows MySQL5.5 搭建3307多实例从库(避坑完整版)
一、环境准备
系统:Windows10
数据库版本:MySQL5.5
原有实例:3306主库
新建实例:3307从库
二、完整操作步骤
1. 复制独立程序目录
复制原安装目录:
C:\Program Files (x86)\MySQL\MySQL Server 5.5 → 改名 MySQL Server 5.5_3307
复制原数据目录:
C:\ProgramData\MySQL\MySQL Server 5.5\Data → 改名 MySQL Server 5.5_3307\Data
核心要点:两个实例目录完全分离,不能共用文件夹。
2. 编写独立my.ini配置文件
在3307程序根目录新建my.ini(必须使用该文件名),只需要改端口号、路径,内容如下:
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
#

4650

被折叠的 条评论
为什么被折叠?



