生产环境Mysql(Mariadb)需要重启时,必须首先用mysqld --help --verbose测试配置文件是否正常,避免启动失败导致的长时间停服

生产环境Mysql(Mariadb)需要重启时,必须首先用mysqld --help --verbose测试配置文件是否正常,避免启动失败导致的长时间停服造成不必要的客户损失,影响客户体验。

案例一:查看当前某个配置文件的状态,如查看log-queries-not-using-indexes

 [root@iZ25ja2kaemZ ~]# /usr/libexec/mysqld --help --verbose |grep log-queries-not-using-indexes
200301 21:13:19 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.
  --log-queries-not-using-indexes
log-queries-not-using-indexes     TRUE
[root@iZ25ja2kaemZ ~]#
案例二:查看以当前的配置文件启动,是否有错误,如本案例中就有一个警告,如果有错误,会用[ERROR]列出来。
[root@iZ25ja2kaemZ ~]# /usr/libexec/mysqld --help --verbose |head -n 20

200301 21:11:24 [Warning] '--log_slow_queries' is deprecated and will be removed in a future release. Please use ''--slow_query_log'/'--slow_query_log_file'' instead.
/usr/libexec/mysqld  Ver 5.1.73-log for redhat-linux-gnu on x86_64 (Source distribution)
Copyright (c) 2000, 2013, 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.

Starts the MySQL database server.

Usage: /usr/libexec/mysqld [OPTIONS]

Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
The following groups are read: mysqld server mysqld-5.1
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

[root@iZ25ja2kaemZ ~]#


 

 欢迎加我们微信wang1415035017进入微信高级技术群共同进步,或者扫码加入我们哦(V_V)

生产环境Mysql(Mariadb)需要重启时,必须首先用mysqld --help --verbose测试配置文件是否正常,避免启动失败导致的长时间停服_第1张图片

 

你可能感兴趣的:(mysql)