How to Validate MySQL Server Configuration Settings
This article explains how MySQL 8.0.16's new --validate-config option can be used to test server configuration files, detect deprecated or unknown options, and obtain warnings or errors without fully starting the server.
After upgrading MySQL, many users keep old configuration files that contain options deprecated in newer versions, causing the MySQL service to fail to start; previously users relied on the mysqld --verbose --help command to test options.
MySQL 8.0.16 introduced the --validate-config option, which checks the configuration without starting the server; the server exits with code 0 when no problems are found and with error code 1 on the first invalid setting.
For example, the option tx_read_only was deprecated in MySQL 5.7 and removed in 8.0. Running
./runtime_output_directory/mysqld --tx_read_only=on --validate-configproduces an error such as
2019-03-30T10:40:02.712141Z0 [ERROR] [MY-000067] unknown variable.
The --validate-config flag can also be combined with a configuration file using --defaults-file. An example command is:
./runtime_output_directory/mysqld --defaults-file=/home/nisha/workspace1/my.cnf --validate-configwhich reports errors like
2019-03-07T23:31.411188Z0 [ERROR] [MY-000067] unknown variableif the file contains unsupported options such as tx_read_only=1.
When using --defaults-file, it must appear as the first option on the command line.
Because the server stops at the first invalid value, users should correct each reported problem and rerun the validation to uncover additional issues.
By default only error messages are shown. To also receive warnings and informational messages, set --log-error-verbosity to a value greater than 1, e.g.:
./runtime_output_directory/mysqld \
--log-error-verbosity=2 --validate-config --read_only=s --transaction_read_only=10This produces warnings such as option 'read_only': boolean value 's' was not recognized while still exiting with code 0 if no fatal errors occur.
When an unknown option like foo=bar is supplied, the server aborts with an error code 1, demonstrating that --validate-config reports both warnings and errors.
The scope of --validate-config is limited to options that can be validated without a full server start; it does not cover storage‑engine‑specific or plugin‑specific options that are only initialized during normal startup. Further details are available in the MySQL documentation.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
