配置MySQL多实例时,报错mysqld: Table ‘mysql.plugin‘ doesn‘t exist 的一个原因

本文介绍了一种解决MySQL多实例环境下初始化后无法启动的问题,主要原因是mysqld在初始化时未能正确读取定制的my.cnf配置文件,通过调整默认路径设置解决了该问题。

今天配置MySQL多实例时,初始化后,启动不成功,看error log,报错信息如下

在网上看,大多数说的都是忘记初始化了,但是我是有初始化的。

这个原因是mysqld初始化时,会先从默认路径去找my.cnf,如果找到了,是不会读取你定制的my.cnf的。

1、先查看mysqld默认查找的路径

mysqld --help --verbose|grep my.cnf

2、将/etc/my.cnf /etc/mysql/my.cnf (如果有)rename

mv /etc/my.cnf /etc/my.cnf.bak
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak

3、重新初始化,启动成功

mysqld --initialize-insecure --user=mysql --datadir=/data/3310/data --basedir=/usr/bin/mysql

请帮我分下下面的错误:2025-10-27T14:22:57.905144Z 0 [Note] InnoDB: 5.7.37 started; log sequence number 0 2025-10-27T14:22:57.905864Z 0 [Note] Plugin 'FEDERATED' is disabled. mysqld: Table 'mysql.plugin' doesn't exist 2025-10-27T14:22:57.906016Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2025-10-27T14:22:57.906554Z 0 [Note] Salting uuid generator variables, current_pid: 597173, server_start_time: 1761574977, bytes_sent: 0, 2025-10-27T14:22:57.906611Z 0 [Note] Generated uuid: '6f89ccf2-b340-11f0-bf17-000c29017f9e', server_start_time: 2068559605608783094, bytes_sent: 57483200 2025-10-27T14:22:57.906641Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6f89ccf2-b340-11f0-bf17-000c29017f9e. 2025-10-27T14:22:57.911165Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2025-10-27T14:22:58.619492Z 0 [Note] Auto generated SSL certificates are placed in data directory. 2025-10-27T14:22:58.619550Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2025-10-27T14:22:58.619559Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2025-10-27T14:22:58.620859Z 0 [Warning] CA certificate ca.pem is self signed. 2025-10-27T14:22:58.918347Z 0 [Note] Auto generated RSA key files are placed in data directory. 2025-10-27T14:22:58.918537Z 0 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306 2025-10-27T14:22:58.918558Z 0 [Note] - '0.0.0.0' resolves to '0.0.0.0'; 2025-10-27T14:22:58.918732Z 0 [Note] Server socket created on IP: '0.0.0.0'. 2025-10-27T14:22:58.918870Z 0 [Warning] Insecure configuration for --pid-file: Location '/usr/local/mysql/mysql5.7' in the path is accessible to all OS users. Consider choosing a different directory. 2025-10-27T14:22:58.919090Z 0 [Warning] Failed to open optimizer cost constant tables 2025-10-27T14:22:58.919251Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 2025-10-27T14:22:58.919265Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files. 2025-10-27T14:22:58.919390Z 0 [ERROR] Aborting
10-28
2025-07-15T01:47:13.079564Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2025-07-15T01:47:13.085230Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2025-07-15T01:47:13.085268Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2025-07-15T01:47:13.089551Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2025-07-15T01:47:13.091858Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:47:13.092032Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist 2025-07-15T01:47:13.092048Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition. 2025-07-15T01:47:13.092168Z 0 [ERROR] [MY-000068] [Server] unknown option '--skip-host-cache'. 2025-07-15T01:47:13.092876Z 0 [ERROR] [MY-010119] [Server] Aborting 2025-07-15T01:47:14.634541Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.3) MySQL Community Server - GPL. 2025-07-15T01:47:14.634553Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2025-07-15 01:48:14+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.3-1.el9 started. 2025-07-15 01:48:15+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2025-07-15 01:48:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.3-1.el9 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2025-07-15T01:48:15.303942Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-07-15T01:48:15.484047Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.3) starting as process 1 2025-07-15T01:48:15.489065Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-07-15T01:48:15.826051Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysqld: Table 'mysql.plugin' doesn't exist 2025-07-15T01:48:15.987952Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure. 2025-07-15T01:48:15.988248Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.988425Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.988643Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.988936Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.989117Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.989241Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:15.989393Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:16.029511Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2025-07-15T01:48:16.102642Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2025-07-15T01:48:16.109042Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2025-07-15T01:48:16.109065Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2025-07-15T01:48:16.112856Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. 2025-07-15T01:48:16.113111Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:48:16.113337Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist 2025-07-15T01:48:16.113352Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition. 2025-07-15T01:48:16.113509Z 0 [ERROR] [MY-000068] [Server] unknown option '--skip-host-cache'. 2025-07-15T01:48:16.114316Z 0 [ERROR] [MY-010119] [Server] Aborting 2025-07-15T01:48:17.655908Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.3) MySQL Community Server - GPL. 2025-07-15T01:48:17.655921Z 0 [System] [MY-015016] [Server] MySQL Server - end. 2025-07-15 01:49:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.3-1.el9 started. 2025-07-15 01:49:18+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2025-07-15 01:49:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.3-1.el9 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2025-07-15T01:49:18.325189Z 0 [System] [MY-015015] [Server] MySQL Server - start. 2025-07-15T01:49:18.503797Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.3) starting as process 1 2025-07-15T01:49:18.508845Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-07-15T01:49:18.843299Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysqld: Table 'mysql.plugin' doesn't exist 2025-07-15T01:49:19.009659Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure. 2025-07-15T01:49:19.009978Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.010198Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.010416Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.010663Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.010788Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.010943Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.011062Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables 2025-07-15T01:49:19.050620Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2025-07-15T01:49:19.125374Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. T
07-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值