注意,响应的数据库存储文件也需要一同复制(可能不在MySQL目录下),即配置文件中提到的data下面的文件。
第一个mysql的my.ini文件默认是在如下路径C:\Documents and Settings\All Users\ApplicationData\MySQL\MySQL Server 5.5\my.ini,copy该ini文件存放到E:\MySQL\mysql_base(这个路径可以随意定义),并修改如下内容:
[client]
port=3307 #第一个数据库的默认端口是3306 这里需要另外启用一个端口
# The TCP/IP Port the MySQL Server will listen on
port=3307
# Path to installation directory. All paths are usually resolved relative to this.
basedir="E:\MySQL\MySQL Server 5.5\" #第二个数据库basedir
# Path to the database root
datadir="E:\MySQL\MySQL Server 5.5\data\" #第二个数据库datadir
mysqld install MySQL2 --defaults-file="E:\MySQL\mysql_base\ini\my.ini"
HKEY_LOCAL_MACHINE --> SYSTEM --> CurrentControlSet --> Services
找到刚才创建的MySQL2,将ImagePath修改成如下":
"E:\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="E:\MySQL\mysql_base\ini\my.ini" MySQL2