Running a syntax check on /etc/my.cnf

Usually, I update variables on the fly using something like:

mysql> SET GLOBAL max_connections = 150;

… and then modify /etc/my.cnf to make the change persistent.

The problem in doing this is that you’re not verifying that your /etc/my.cnf is correct and can only hope that a restart doesn’t encounter any problems.

Fortunately, Sai emailed us a great little tip to verify the syntax. You can run the following which will report errors in /etc/my.cnf:

# /usr/libexec/mysqld --help --verbose
081009  9:55:36 [ERROR] /usr/libexec/mysqld: unknown variable 'mmax_connections=150'
 
#

Perfect. Just what the doctor ordered.

Tags:

One Response to “Running a syntax check on /etc/my.cnf”

  1. [...] I found my new best friend when performance tuning mysql. Thanks to this simple post, we can now check the syntax of out “tweaked” my.cnf file BEFORE restarting [...]

Leave a Reply

You must be logged in to post a comment.