繁体   English   中英

mysql:无法使用 mysqld 创建辅助服务器实例

[英]mysql : unable to create secondary server instance using mysqld

我正在使用 mysqld 与现有服务器一起创建一个新服务器 [MYSQL 8.0.27 安装了 windows 安装程序] 以测试数据复制

我已经安装了一个服务器实例 [称为 Mysql80],它是原始服务器,我正在尝试通过阅读这个看起来很简单的文档来使用 mysqld 创建另一个名为 MyTest 的服务器

我创建了一个空的数据目录来保存我的新数据库,并且我的服务器配置文件保存为 conf.cnf

[MyTest]
port = 3310
datadir = E:/Program Files/Developer/MYSQL/Data/TestFolder/Data

从 windows 命令行 我使用他们的确切说明创建服务器

mysqld  --defaults-file=E:/conf.cnf  --console

--console 用于显示调试信息,但我总是得到这些错误

021-12-12T17:17:11.844725Z 0 [System] [MY-010116] [Server] E:\Program Files\Developer\MYSQL\Server 8.0\bin\mysqld.exe (mysqld 8.0.27) starting as process 2328
2021-12-12T17:17:11.875406Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-12T17:17:13.498780Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2021-12-12T17:17:13.866706Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2021-12-12T17:17:13.867207Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.867617Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868042Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868519Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868926Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.869354Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.869707Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.979431Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-12-12T17:17:14.140027Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-12-12T17:17:14.172455Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-12T17:17:14.172592Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-12T17:17:14.175122Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-12-12T17:17:14.175319Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-12-12T17:17:14.176633Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Only one usage of each socket address (protocol/netwo k address/port) is normally permitted.
2021-12-12T17:17:14.176755Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2021-12-12T17:17:14.177195Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-12-12T17:17:15.446688Z 0 [System] [MY-010910] [Server] E:\Program Files\Developer\MYSQL\Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.27)  MySQL Community Server - GPL.

忽略优化器错误并且找不到表错误,服务器总是尝试在端口 3306 上启动,即使我在我的 conf 文件中指定它应该在端口 3310 上

这让我相信我以错误的格式输入了配置文件,或者我没有为作业指定足够的参数

有任何想法吗?

原来我做错了两件事

  1. 我之前已从 mysql 8 升级到 8.27,因此表已损坏,这解释了优化错误

  2. 我的配置格式不正确

从 windows 服务中删除 MySQL 服务并删除我的数据目录后,需要按顺序执行这 3 个步骤

  1. 创建一个新目录来存储数据、配置文件、上传目录[使用 LOAD FILE 等命令]

结构看起来像这样

->Warehouse1
 |--->Data
 |--->Uploads
 |--->MyConfig.cnf

MyConfig.cnf 如下所示

[mysqld]
basedir="E:\Program Files\Developer\MYSQL\Server 8.0"
port=3306
datadir="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\Data"
secure-file-priv="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\Uploads" 

2)使用mysqld从windows命令行初始化数据目录,如下所示

mysqld --defaults-file="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\config.cnf" --initialize

3)最后创建一个你可以在 Windows Services window 中更改的服务

mysqld --install MySQL81  --defaults-file="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\config.cnf"

重复相同的步骤来创建第二个服务器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM