shell> mysqld --validate-config --log_error_verbosity=2 --read-only=s --transaction_read_only=s 2018-11-05T15:43:18.445863Z 0 [Warning] [MY-000076] [Server] option ’read_only’: boolean value ’s’ was not recognized. Set to OFF. 2018-11-05T15:43:18.445882Z 0 [Warning] [MY-000076] [Server] option ’transaction-read-only’: boolean value ’s’ was not recognized. Set to OFF. 

This command produces the same warnings, but also an error, so the error message is displayed along with the warnings and the exit code is 1: 

shell> mysqld --validate-config --log_error_verbosity=2 --no-such-option --read-only=s --transaction_read_only=s 2018-11-05T15:43:53.152886Z 0 [Warning] [MY-000076] [Server] option ’read_only’: boolean value ’s’ was not recognized. Set to OFF. 2018-11-05T15:43:53.152913Z 0 [Warning] [MY-000076] [Server] option ’transaction-read-only’: boolean value ’s’ was not recognized. Set to OFF. 2018-11-05T15:43:53.164889Z 0 [ERROR] [MY-000068] [Server] unknown option ’--no-such-option’. 2018-11-05T15:43:53.165053Z 0 [ERROR] [MY-010119] [Server] Aborting 

The scope of the --validate-config  option is limited to configuration checking that the server can perform without undergoing its normal startup process. As such, the configuration check does not initialize storage engines and other plugins, components, and so forth, and does not validate options associated with those uninitialized subsystems. 

--validate-config  can be used any time, but is particularly useful after an upgrade, to check whether any options previously used with the older server are considered by the upgraded server to be deprecated or obsolete. For example, the tx_read_only  system variable was deprecated in MySQL 5.7 and removed in 8.0. Suppose that a MySQL 5.7 server was run using that system variable in its my.cnf  file and then upgraded to MySQL 8.0. Running the upgraded server with --validate-config  to check the configuration produces this result: 

shell> mysqld --validate-config 2018-11-05T10:40:02.712141Z 0 [ERROR] [MY-000067] [Server] unknown variable ’tx_read_only=ON’. 2018-11-05T10:40:02.712178Z 0 [ERROR] [MY-010119] [Server] Aborting 

--validate-config  can be used with the --defaults-file  option to validate only the options in a specific file: 

shell> mysqld --defaults-file=./my.cnf-test --validate-config 2018-11-05T10:40:02.712141Z 0 [ERROR] [MY-000067] [Server] unknown variable ’tx_read_only=ON’. 2018-11-05T10:40:02.712178Z 0 [ERROR] [MY-010119] [Server] Aborting 

Remember that --defaults-file , if specified, must be the first option on the command line. (Executing the preceding example with the option order reversed produces a message that --defaults-file  itself is unknown.) 

## 5.1.4 Server Option, System Variable, and Status Variable Reference 

The following table lists all command-line options, system variables, and status variables applicable within mysqld . 

The table lists command-line options (Cmd-line), options valid in configuration files (Option file), server system variables (System Var), and status variables (Status var) in one unified list, with an indication of where each option or variable is valid. If a server option set on the command line or in an option file differs from the name of the corresponding system variable, the variable name is noted immediately below the corresponding option. For system and status variables, the scope of the variable (Var Scope) is Global, Session, or both. Please see the corresponding item descriptions for details on setting and using the options and variables. Where appropriate, direct links to further information about the items are provided. 

