In the Apache world, you might be familiar with tweaking your config file(s) and then running

$ apachectl configtest

to see if the config parses. We've been discussing this on the drizzle mailing list and talking in general about configuration handling and management. Well, it turns out that you can fake it in MySQL and Drizzle too.

If you have a new configuration in /tmp/new.cnf, try this:

$ mysqld --defaults-file=/tmp/new.cnf --verbose --help

And it'll run mysqld (or drizzled), parse the config, report any problems, print help, and exit without initializing storage engines or trying to grab a port.

Neat trick!

Thanks to Baron Schwartz, Arjen Lentz, and Sheeri Cabral (book) for helping to demonstrate this.

Posted by jzawodn at April 29, 2009 07:45 AM

Reader Comments
# Anand said:

When I add a "log_bin_trust_function_creators=1" in the conf to get my triggers to run in 5.1.34, the above option craps out and gives me the following error - 090506 17:13:35 [ERROR] mysqld: unknown variable 'log_bin_trust_function_creators=1'. However when I start the MySQL server and do a show variables it shows that the triggers are enabled.

So I was wondering whether the above is really a reliable way to test the configuration file. It didn't work for me.

on May 6, 2009 05:17 AM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.


Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.