2 Minuten Lesezeit (325 Worte)

Pleasing DBAs with small things: Validation of MySQL configuration

Configuration files are a constant source of errors. Especially with older systems (before version 8.0), which did not yet have the possibility to make online persistent changes (e.g. "set global persist…"), there were often minor problems. The parameter was set online (but volatile; i.e. not rebootable) due to a lack of downtime and was written to the configuration in parallel. If one mistyped here, one could go troubleshooting at the next planned or unplanned (!) restart of the DB. 

Configuration gibberish 

The spelling of name fidelity of parameters in the configuration file(s) (e.g. /etc/my.cnf or similar) is not very high. Is the parameter declared as "log_bin", "log-bin" or "logbin"? Surely some MySQL DBAs face such and/or similar questions quite often in practice. If you can restart the server, you can "iteratively" ( ;-) ) find the correct notation. But in the scenario described above (downtime unwanted) this is not possible. 

Just a little thing? 

Starting with version 8.0.16 there is now the possibility to check the configuration. For this, the option “--validate-config” was introduced. Here is a small example: 

# correct configuration 

bash> /etc/mysql/mysql.conf.d# mysqld --defaults-file=mysqld.cnf --validate-config 

bash> /etc/mysql/mysql.conf.d# echo $? 

0 

 

# a small typo 

bash> echo "slowquerylog = ON" >> mysqld.cnf 

bash> mysqld --defaults-file=mysqld.cnf --validate-config 

2022-10-24T07:31:41.928416Z 0 [ERROR] [MY-000067] [Server] unknown variable 'slowquerylog=ON'. 

2022-10-24T07:31:41.928495Z 0 [ERROR] [MY-010119] [Server] Aborting  

Experienced MySQLers will know. The parameter is called "slow_query_log", of course. The error is reliably detected and should be corrected as soon as possible. 

Just a small thing! 

Yes, the new "--validate-config" parameter of the MySQL service is not a "big deal". Other applications (e.g. the Apache web server) know such options and / or commands to check the configuration status for a long time. Still, it's nice to see that even such small, unobtrusive improvements make it into the new MySQL releases.

Do you have questions about MySQL? Please contact us. 

Principal Consultant bei ORDIX

 

Kommentare

Derzeit gibt es keine Kommentare. Schreibe den ersten Kommentar!
Mittwoch, 24. April 2024

Sicherheitscode (Captcha)

×
Informiert bleiben!

Bei Updates im Blog, informieren wir per E-Mail.

Weitere Artikel in der Kategorie