mysql - 在mysql中运行多个mysql实例

标签 mysql instance my.cnf

我想在同一台机器上的两个不同端口上使用 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"

最佳答案

最好使用 mysql_multi http://www.pythian.com/blog/using-mysqld_multi-to-manage-multiple-servers/

配置的副本是肮脏的骇客

关于mysql - 在mysql中运行多个mysql实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1081588/

相关文章:

sql - 即使将最大数据包增加到 128M,MySQL 服务器也消失了?

MySQL HAVING 给了我不同的结果

java - 静态 block 初始化

java - 我在为刚刚使用 Java 创建的类创建实例对象时遇到困难

JavaScript - 如何将新实例设置为动态创建的参数?

mysql - MariaDB 10.2 性能调优 - 锁等待超时问题

mysql - 如何将子查询中的字符串连接到mysql中的一行?

php - Mysql搜索以逗号分隔的字符串

mysql - SQL 多对多关系、多表

mysql - 5.6.17如何配置my.cnf?