我想在同一机器上使用MySQL服务器上的两个不同的端口。我做了两个独立的配置文件。当我试图连接到MySQL服务器我所定义的第二个端口上,则无法连接。运行MySQL的操作系统是Windows Vista中。我还试图指定端口之后,开始从命令行mysqld

这是我已经改变为MySQL服务器样品文件以从两个不同的端口读:

# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

port=3306

[mysql]
mysql-path="C:\Program Files\MySQL\MySQL Server 5.1\bin"
default-character-set=latin1

[client]

port=3307

[mysql1]
mysql1-path="C:\Program Files\MySQL2\MySQL Server 5.1\bin"
default-character-set=latin1

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]
mysqld-path="C:\Program Files\MySQL\MySQL Server 5.1\bin\"

# The TCP/IP Port the MySQL Server will listen on
port=3306

#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.1/"

#Path to the database root
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/"
#
server_id=1

[mysqld1]
# The TCP/IP Port the MySQL Server will listen on
port=3307
server_id=2
mysqld1-path="C:\Program Files\MySQL2\MySQL Server 5.1\bin\"

#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL2/MySQL Server 5.1/"

#Path to the database root
datadir="C:/ProgramData/MySQL2/MySQL Server 5.1/Data/"
#
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=latin1

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
有帮助吗?

解决方案

在安装过程稍有不同的基于服务器/操作系统。

有关Linux的你可能会发现这个有用的 - 的 http://code.openark.org/blog/mysql/manually-installing-multiple-mysql-instances-on-linux-howto

谷歌它,你可能会发现其他人了。

其他提示

更好地使用mysql_multi HTTP://www.pythian的.com /博客/使用-mysqld_multi的管理的数倍的服务器/

CONFIGS的拷贝是肮脏的黑客IMHO

您还需要指定一个不同datadir上的命令行(即,其包含数据库文件的目录)。不能在不同的实例打开相同的数据库,因为他们将锁定彼此和/或引起数据损坏。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top