How to validate server configuration settings.

After upgrading the server many users start it with an unchanged config file only to find some deprecated options that they were using are no longer supported by the later server version, which causes the upgraded server to shutdown. In other cases modifying the server configuration file results in the server refusing to start when an invalid name is mistakenly entered in the configuration file. In MySQL 5.7, users relied on using the combination of ‘help’ and ‘verbose’ options along with server configurations to test the options i.e.

In MySQL 8.0.16, a new option called ‘validate-config’ has been introduced to help users to quickly test the server configuration without having to run the server. If there are no issues found, the server exits with an exit code of zero. The server will exit with an error (error no 1) for first occurrence of an invalid configuration. For example, let us consider the server option ‘tx_read_only’ which was deprecated in MySQL 5.7 and removed MySQL 8.0:

The validate-config option can also be used with a configuration file to check the options specified in the configuration file. For example:

Please note that when using the defaults-file option, it should be the first option on the command line as shown above.

Since the server exits on the first occurrence of an invalid value, correct the problem reported and re-run to find any further issues in the configuration settings.

By default only error messages are reported. If users are also interested in warning and information messages, the log_error_verbosity option needs to be mentioned
with a value greater than 1.

As seen above, warnings about configuration settings are reported and the server exits
with zero since there are no errors. In the example below, an invalid configuration name
is mentioned, hence an error is reported along with the warnings and the server exits with
error code 1.

The scope of ‘validate-config’ is limited to validation of options which can be performed
without the normal start up of the server. Hence options specific to storage engines and plugins which are initialized during the normal start up of the server are not covered by ‘validate-config‘. Information about ‘validate-config‘ can also be found in the MySQL documentation.  We hope this new option makes the lives of MySQL users easier especially during upgrades.

As always, THANK YOU for using MySQL!

About Nisha Gopalakrishnan

Nisha Gopalakrishnan has been working with MySQL database since 2012. She is working out of the Oracle office in Bangalore as a Senior Software Engineer. Her industry background has been system software development in database internals, file system and security.

One thought on “How to validate server configuration settings.

Leave a Reply