[ERROR] [MY-011268] 、[ERROR] [MY-010175][Server] Configuring persisted options failed

  持久化修改log_error_services='log_filter_internal; log_sink_internal; log_sink_json’之后,卸载了"log_sink_json"组件,重启MySQL报错:

[root@chengyu ~]# systemctl start mysqld8
Job for mysqld8.service failed because the control process exited with error code. See "systemctl status mysqld8.service" and "journalctl -xe" for details.
[root@chengyu ~]# systemctl status mysqld8
● mysqld8.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysqld8; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2020-07-27 15:02:59 CST; 17s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 7728 ExecStop=/etc/rc.d/init.d/mysqld8 stop (code=exited, status=0/SUCCESS)
  Process: 8000 ExecStart=/etc/rc.d/init.d/mysqld8 start (code=exited, status=1/FAILURE)
    Tasks: 20
   CGroup: /system.slice/mysqld8.service
           ├─1738 /bin/sh /usr/local/mysql8/bin/mysqld_safe --datadir=/home/mysql8/data --pid-file=/...
           └─8566 /usr/local/mysql8/bin/mysqld --basedir=/usr/local/mysql8 --datadir=/home/mysql8/da...

Jul 27 15:02:58 chengyu systemd[1]: Starting LSB: start and stop MySQL...
Jul 27 15:02:59 chengyu mysqld8[1702]: 2020-07-27T07:02:59.774859Z mysqld_safe mysqld process ha...lled
Jul 27 15:02:59 chengyu mysqld8[8000]: Starting MySQL./usr/local/mysql8/bin/mysqld_safe: line 199:  ...
Jul 27 15:02:59 chengyu mysqld8[8000]: ERROR! The server quit without updating PID file (/usr/lo...id).
Jul 27 15:02:59 chengyu systemd[1]: mysqld8.service: control process exited, code=exited status=1
Jul 27 15:02:59 chengyu systemd[1]: Failed to start LSB: start and stop MySQL.
Jul 27 15:02:59 chengyu systemd[1]: Unit mysqld8.service entered failed state.
Jul 27 15:02:59 chengyu systemd[1]: mysqld8.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

  打开错误日志看一看:[root@chengyu ~]# vim /home/mysql8/data/chengyu.err

  2020-07-27T07:07:18.020099Z 6 [ERROR] [MY-011268] [Server] Configuring persisted options failed: “Variable ‘log_error_services’ can’t be set to the value of ‘log_filter_internal; log_sink_internal; log_sink_json’”.
2020-07-27T07:07:18.020561Z 6 [Warning] [MY-013140] [Server] Error in diagnostics area: MY-003701 - Value for log_error_services got confusing at or around “log_sink_json”. Syntax may be wrong, component may not be INSTALLed, or a component that does not support instances may be listed more than once.
2020-07-27T07:07:18.021035Z 0 [ERROR] [MY-010175] [Server] Setting persistent options failed.

  原因在MySQL 8之前的版本中,修改全局变量只会影响其内存值,而不会持久化到配置文件中,重启数据库就会失效;但是从MySQL 8开始,通过SET PERSIST命令修改的全局变量会持久化到具体的配置文件中,也就是mysqld-auto.cnf文件中,即便你在my.cnf还是修改前的值,依然会在启动的时候以mysqld-auto.cnf文件的修改值为准。

  之前我使用“SET PERSIST log_error_services = ‘log_filter_internal; log_sink_internal; log_sink_json’;”持久化了log_error_services变量,该变量就写入MySQL数据目录的mysqld-auto.cnf中 ,MySQL数据库启动时,先读取默认配置文件my.cnf,再读取mysqld-auto.cnf文件,所以,即便我在my.cnf中配置了 log_error_services = ‘log_filter_internal; log_sink_internal’,mysqld-auto.cnf中的log_error_services 依然会被再次读取,重启也还报如上ERROR。

  解决:修改mysqld-auto.cnf中的log_error_services值,这里根据ERROR提示删除掉log_sink_json即可:

  [root@chengyu ~]# vim /home/mysql8/data/mysqld-auto.cnf

  修改前:

{ "Version" : 1 , "mysql_server" : { "log_error_services" : { "Value" : "log_filter_internal;
 log_sink_internal; log_sink_json" , "Metadata" : { "Timestamp" : 1595486647764821 , 
 "User" : "root" , "Host" : "localhost" } } } }

  修改后:

{ "Version" : 1 , "mysql_server" : { "log_error_services" : { "Value" : "log_filter_internal;
 log_sink_internal" , "Metadata" : { "Timestamp" : 1595486647764821 , 
 "User" : "root" , "Host" : "localhost" } } } }

  重启OK:

[root@chengyu ~]# systemctl start mysqld8
[root@chengyu ~]# systemctl start mysqld8
[root@chengyu ~]# systemctl status mysqld8
● mysqld8.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mysqld8; bad; vendor preset: disabled)
   Active: active (running) since Tue 2020-07-28 10:36:20 CST; 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 16612 ExecStop=/etc/rc.d/init.d/mysqld8 stop (code=exited, status=0/SUCCESS)
  Process: 16288 ExecStart=/etc/rc.d/init.d/mysqld8 start (code=exited, status=0/SUCCESS)
    Tasks: 40
   CGroup: /system.slice/mysqld8.service
           ├─16310 /bin/sh /usr/local/mysql8/bin/mysqld_safe --datadir=/home/mysql8/data --pid-file=...
           └─16649 /usr/local/mysql8/bin/mysqld --basedir=/usr/local/mysql8 --datadir=/home/mysql8/d...

Jul 28 10:36:18 chengyu systemd[1]: Starting LSB: start and stop MySQL...
Jul 28 10:36:20 chengyu mysqld8[16288]: Starting MySQL.. SUCCESS!
Jul 28 10:36:20 chengyu systemd[1]: Started LSB: start and stop MySQL.

[root@chengyu ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.20 Source distribution

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT @@GLOBAL.log_error_services;
+----------------------------------------+
| @@GLOBAL.log_error_services            |
+----------------------------------------+
| log_filter_internal; log_sink_internal |
+----------------------------------------+
1 row in set (0.00 sec)

2020年7月27日

  阳台上的茉莉花开了,娇小、圣洁、淡雅,清香怡人。

  即便在这酷热黏腻的气温下,它那周身的清冽也毫不示弱的张扬着它不可亵渎的性冷淡气质。

猜你喜欢

转载自blog.csdn.net/u010257584/article/details/107612467